<
INPUT
TYPE
=
"text"
id
=
"k"
><
INPUT
TYPE
=
"button"
VALUE
=
"ok"
ONCLICK
=
"xx()"
>
<
SCRIPT
LANGUAGE
=
"JavaScript"
>
<!--
function xx(){
var k=document.getElementById("k").value;
var tab=document.getElementById("tab");
var td=tab.getElementsByTagName(‘td‘)
var tdl=td.length;
for (i=0;i<tdl ;i++ ){
td[i].style.backgroundColor="#fff";//
if (td[i].innerHTML.indexOf(k)>-1 ){
td[i].style.backgroundColor="#ddd";//
}
}
}
//-->
</
SCRIPT
>
如何在html添加一个搜索框和一个按钮?
时间: 2024-11-06 21:17:57