任何人都可以告訴我我的代碼出了什麼問題。我特林創建一個表濾波器,這是我的javascript代碼:不適用於JavaScript的代碼過濾器
function searchRegExFieldKeyUp() {
var q = this.value
var v = q.value.toLowerCase();
var rows = document.getElementsByTagName("tr");
var on = 0;
for (var i = 0; i < rows.length; i++) {
var fullname = rows[i].getElementsByTagName("td");
fullname = fullname[0].innerHTML.toLowerCase();
if (fullname) {
if (v.length == 0 || (v.length < 3 && fullname.indexOf(v) == 0) || (v.length >= 3 && fullname.indexOf(v) > -1)) {
rows[i].style.display = "";
on++;
} else {
rows[i].style.display = "none";
}
}
}
}
這是我的html:
function dynamic_checkbox_table(){
// connect to the database
$con = mysqli_connect(DB_HOST,DB_SELECT,DB_PASSWORDSELECT,DB_PHYSBINDER) or die ('DB-connection failed...');
// query the database
$sql = "SELECT * FROM Models";
$result = mysqli_query($con,$sql) or die(mysqli_error() . "<br/>$sql");
// run through the results from the database, generating the checkboxes
?>
<Table id="ModelFilter">
<?php
while ($row = mysqli_fetch_assoc($result)) {
?>
<tr><td><li> <?php echo $row['Model'];?>
<br><input id="<?php echo $row['ModelID'] ?>" name="<?php echo $row['Model']?>" type="checkbox" /></li></td></tr></br>
「; dynamic_checkbox_table(); >
更新您的問題,包括你想什麼來完成,哪些錯誤是。 –