gpt4 book ai didi

javascript - 包含外部 html 表数据

转载 作者:太空宇宙 更新时间:2023-11-04 15:32:55 24 4
gpt4 key购买 nike

好的,我有一个 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。非常简单且有效。

关于javascript - 包含外部 html 表数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44653622/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com