这是你要的效果吗?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>highLight</title>
<style>
td{ font-family: Courier New; font-size: 12px; text-align: center ;height:30;word-break:break-all;}
</style>
</head>
<body>
<script defer>
//***by fason(2003-6-21)****//
var i=0;
var h=[]
function myTestTable(oTb,oBgOver,oBgLight){
h=[null,null,oBgOver,oBgLight]
var t=document.getElementById(oTb);
for(m=0;m<t.rows.length;m++){
t.rows[m].attachEvent("onmouseover",new Function("oOver("+i+")"))
t.rows[m].attachEvent("onmouseout",new Function("oOut("+i+")"))
t.rows[m].attachEvent("onclick",new Function("oLight("+i+")"))
}
i++;
}
function oOver(n){
var e=event.srcElement;
if(e.tagName!="TD")return;
e=e.parentElement
h[n][1]=e.currentStyle.backgroundColor
e.style.backgroundColor=h[n][2]
}
function oOut(n){
var e=event.srcElement;
if(e.tagName!="TD")return;
e=e.parentElement
e.style.backgroundColor=h[n][1]
}
function oLight(n){
var e=event.srcElement;
if(e.tagName!="TD")return;
e=e.parentElement
if(h[n][0]==null)h[n][0]=e;
h[n][0].style.backgroundColor=h[n][1]
h[n][0].style.color=''
h[n][0]=e;
h[n][1]=e.style.backgroundColor=h[n][3]
}
myTestTable("test","#f2f2f2","#d2e8ff")
myTestTable("myTable","#d2e8ff","#f2f2f2")
</script>
<table id='myTable' border="1" width=100>
<tr>
<td width="100%">td1</td>
</tr>
<tr>
<td width="100%">td2</td>
</tr>
<tr>
<td width="100%">td3</td>
</tr>
<tr>
<td width="100%">td4</td>
</tr>
</table>
<table border="1" width="100" id='test'>
<tr>
<td width="100%">td1</td>
</tr>
<tr>
<td width="100%">td2</td>
</tr>
<tr>
<td width="100%">td3</td>
</tr>
<tr>
<td width="100%">td4</td>
</tr>
</table>
</body>
</html>