<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml" >
<head>
<title>js Query the contents of the table and add the content cell </title>
<meta http-equiv= "Content-type" content= "text/html;charset=gb2312" >
<!--Add the following code to <head> and </head>-->
<script language= "JavaScript" >
var IDs;
var Idstext;
function Hightlight_td () {
var text=txt.value;
Tds=document.all.table1.all.tags ("TD")
//When using IFRAME:
//tds=iframe name.document.all.table1.all.tags ("TD")
if (text!= "") {
for (Var i=0;i<tds.length;i++) {
Obj=tds[i];
Idstext=obj.innertext;
idnum=idstext.indexof (text);
if (idnum!=-1) {
obj.style.background= "Red";
}else{
obj.style.background= "#FFFFFF";
}
}
}else{
alert ("Please enter a string to query!") ");
}
}
</script>
</head>
<body>
<!--Add the following code to <body> and </body>-->
<table border= "1" cellspacing= "0" width= "cellpadding=" "0" id= "table1" >
<tr>
<td width= >12</td>
<td width= >34</td>
<TD width= >56</td>
<td width= >78</td>
<td width= >90</td>
</tr>
<tr>
<td width= >abc</td>
<td width= >def</td>
<td width= >ghj</td>
<td width= >lop</td>
<td width= >dry</td>
</tr>
<tr>
<td width= >!@#</td>
<td width= >_ (*</td>
<td width= >#$%</td>
<td width= >^$#</td>
<TD width= >WWW</td>
</tr>
</table>
<input type= "text" name= "TXT" ><input type= "button" value= "Enter the string to query, such as" onclick= "hightlight_td (); >
</body>
</html>