功能在Firefox中无效但在Chrome和Internet Explorer以及Micrisoft Edge中有效,请帮忙
function myFunctionN()
{
var filter = event.target.value.toUpperCase();
var rows = document.querySelector("#tablenew").rows;
for (var i = 1; i < rows.length; i++) {
var firstCol = rows[i].cells[0].textContent.toUpperCase();
var secondCol = rows[i].cells[1].textContent.toUpperCase();
var thirdCol = rows[i].cells[2].textContent.toUpperCase();
var fourtCol = rows[i].cells[3].textContent.toUpperCase();
var fiftCol = rows[i].cells[4].textContent.toUpperCase();
if (firstCol.indexOf(filter) > -1
|| secondCol.indexOf(filter) > -1
|| thirdCol.indexOf(filter) > -1
|| fourtCol.indexOf(filter) > -1
|| fiftCol.indexOf(filter) > -1
)
{
rows[i].style.display = "";
} else {
rows[i].style.display = "none";
}
}
}
html / php代码,这里没有数据因为它在DB echo fetch_data中被提取到表中
<input type="text" id="myInput" onkeyup="myFunctionN()" placeholder="Search For Anything.." title="Type, What Ever You Looking For">
<div class="table-responsive">
<table id="tablenew" class="table table-bordered">
<tr>
<th width="5%">ID</th>
<th width="30%">Name</th>
<th width="10%">Gender</th>
<th width="45%">Designation</th>
<th width="10%">Age</th>
</tr>
<?php
echo fetch_data();
?>
</table>
<br />
</div>
答案 0 :(得分:0)
@Xufox - 你的态度真的很糟糕,但是你跟那个事件走在了正确的轨道上......我不是程序员,所以你说的方式对我来说没有任何意义,但在尝试了500之后不同的组合:)终于搞定了,所以@Xufox ...基本上在脚本函数myFunction04(事件)中添加了事件,在html onkeyup =“myFunction04(事件)”中的事件......问题解决了。谢谢