better use a function, placed in the HEAD. And CSS properties:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function changeBG(tr,color){
tr.style.backgroundColor=color;
}
</script>
</head>
<body>
<table width="100" border="1">
<tr><td onmouseover="changeBG(this,'#000')" onmouseout="changeBG(this,'#fff')">z</td></tr>
<tr><td onmouseover="changeBG(this,'#000')" onmouseout="changeBG(this,'#fff')">z</td></tr>
</table>
</body>
</html>
but even better you can attach the events dynamically.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
onload=function(){
var oncolor="#000";
var offcolor="#fff";
var allTD=document.getElementById('mytab').getElementsByTagName('td'), td, i=0;
while(td=allTD[i++]){
td.onmouseover=function(){this.style.backgroundColor=oncolor}
td.onmouseout=function(){this.style.backgroundColor=offcolor}
}
}
</script>
</head>
<body>
<table width="100" border="1" id="mytab">
<tr><td>z</td></tr>
<tr><td>y</td></tr>
</table>
</body>
</html>