我是编码新手,正在尝试创建一个表,其中每一列都可以进行过滤。我从JSFiddle资源中拼凑了这段代码,它在他们的网站上运行得很好,但我无法让它在其他地方运行。它引用了一个外部的js,我认为这就是它可能出错的地方。
以下是指向原始资源的链接:http://jsfiddle.net/eCqG3/3229/
这是我的版本:
var table2_Props = {
col_0: "select",
col_1: "select",
col_2: "select",
col_3: "select",
display_all_text: " [ Show all ] ",
sort_select: true
};
var tf2 = setFilterGrid("table2", table2_Props);
table.table2 {
background-color: #ffffff;
color: #4e4e4e;
cursor: pointer;
padding: 10px;
width: 100%;
border: none;
text-align: left;
<script src="http://tablefilter.free.fr/TableFilter/tablefilter_all_min.js"></script>
<p>Add a drop-down filter, define its first option, sort it and remove a filter</p>
<table id="table2" cellpadding="0" cellspacing="0">
<tr>
<th>Account Type</th>
<th>Form Name</th>
<th>Form Type</th>
<th>Account Name</th>
<th>Special Instructions</th>
</tr>
</table>
非常感谢你的帮助--我真的卡住了!
发布于 2018-08-24 04:05:08
你的脚本是在DOM之前执行的,它已经准备好了。
将脚本放在结束</body>
标记之前,或使用以下代码:
document.addEventListener("DOMContentLoaded", function(event) {
// your js code
});
发布于 2018-08-24 21:09:46
javascript未加载。
https://stackoverflow.com/questions/51992701
复制相似问题