日期:2014-05-17 浏览次数:20970 次
<TABLE width="960" border="0" align="center" cellpadding="0" cellspacing="0" id="tab"> <TR> <TD>1111</TD> <TD>aaa</TD> </TR> <TR> <TD>2222</TD> <TD>bbb</TD> </TR> <TR> <TD>333</TD> <TD>ccc</TD> </TR> <TR> <TD>444</TD> <TD>ddd</TD> </TR> <TR> <TD>5556</TD> <TD>eee</TD> </TR> <TR> <TD>666</TD> <TD>fff</TD> </TR> </TABLE><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>
------解决方案--------------------