纯js实现隔行换色实例

来源:互联网 发布:破解版五星软件 编辑:程序博客网 时间:2024/05/16 11:03
<?php<head>隔行换色</head><body><script>document.write('<table border="1" width="800" align="center">');var i=0;while (i<100) {if (i%10==0) {//打印表格if(i%20)//定义隔行换色的颜色bg="#cccccc";elsebg="#ffffff";document.write('<tr onmouseover="show(this)" onmouseout="noshow(this)" bgcolor="'+bg+'">');//定义两个鼠标事件,完成隔行换色的实现} //输出1000个格子document.write('<td>'+i+'</td>');i++;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>?>


	
				
		
原创粉丝点击