JavaScript 表格数据搜索
2023-07-01 08:21
JavaScript
110
0
0
0
标题录入
封面图
``` <script> function searchFunction() { // Declare variables var input, filter, table, tr, td, i; input = document.getElementById("myInput"); filter = input.value.toUpperCase(); table = document.getElementById("myTable"); tr = table.getElementsByTagName("tr"); // Loop through all table rows, and hide those who don't match the search query for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[0]; if (td) { if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } } </script> ```
上一篇:
如何使用submit,进行ajax数据提交
下一篇:
js获取年月日
标题录入,一次不能超过6条
怎么提高认知水平?
T:0.006921s,M:244.77 KB
返回顶部
留言
留言
评论