好的,所以我有一个HTML jquery tablesorter网页。与其将所有“ td”标签嵌入同一文件中,我想从一个单独的文件中加载它们。原因是数据非常大,并且是模块化所必需的。到目前为止,这是我正在尝试的...。

        <div id="demo"><table class="tablesorter">
<script src="https://www.w3schools.com/lib/w3.js"> w3.includeHTML();</script>
        <br>
                <!-- Table Head -->
                <thead>
                    <tr>
                        <th>Sensor</th> <!-- disable dragtable on this column -->
                        <th class="drag-enable">c1</th>
                        <th class="drag-enable">c2</th>
                        <th class="drag-enable">c3</th>
                        <th class="drag-enable">c4</th>
                        <th class="drag-enable">c5</th>
                        <th class="drag-enable">c6</th>
                    </tr>
                </thead>
                <!-- Table Footer -->
                <tfoot>
                    <tr><th>c1</th><th>c2</th><th>c3</th><th>c4</th><th>c5</th><th>c6</th><th>c7</th></tr>
                </tfoot>
                <!-- Table Content -->
                <tbody w3-include-html="C:\Users\user\Desktop\new_test\tabledata.html">
                </tbody>
            </table>
        </div>

最佳答案

我让它像这样工作:

            <table id="table" class="tablesorter">

                <script src="columndata.js"></script>

            </table>


然后在.js文件中,我只有一个变量和document.write。非常简单且有效。

07-24 09:43
查看更多