-1
功能不工作,但它在Chrome和Internet Explorer和Micrisoft邊緣,請大家幫忙功能不工作,但工作在火狐瀏覽器
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代碼,就在這裏沒有數據COS其DB回聲則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>
您正在使用哪種版本的Firefox,Chrome和Edge? –
控制檯中的錯誤是什麼?這裏的'事件'是什麼? –
看來你正在使用'event'而沒有定義它。將它用作這樣的參數:'function myFunctionN(event){'...'}'。 – Xufox