js实现表格隔行换色,并且鼠标滑过时高亮显示特效代码。
例子:
 
<html> 
<head> 
<title>js表格隔行换色与高亮显示特效代码 - www.jb200.com</title> 
</head> 
<body> 
<script type="text/javascript"> 
document.write('<table border="1" width="800" align="center">'); 
var i=0; 
while(i<1000){ 
if(i%10==0){ 
if(i%20==0) 
bg="#cccccc"; 
else 
bg="#ffffff"; 
document.write('<tr onmouseover="show(this)" onmouseout="noshow(this)" bgcolor="'+bg+'">') 
} 
document.write('<td>'+i+'</td>'); 
i++; 
//document.write('</tr>'); 
} 
if(i%10==0){ 
document.write('</tr>'); 
} 
document.write('</table>');
var ys=null; 
function show(obj){ 
ys=obj.bgColor; 
obj.bgColor="red"; 
} 
function noshow(obj){ 
obj.bgColor=ys; 
} 
</script> 
</body> 
</html>