原生javascript实现隔行换色
js让我们一起从基础来学习,我们一点一点的来学习
下边是我写的代码,然后大家看着学习下吧!!!
<html>
<head>
<title>js演示</title>
</head>
<body>
<script>
document.write('<tableborder="1"width="100px"align="center">');
vari=0;
while(i<100){
if(i%10==0){
if(i%20==0)
bg="#cccccc";
else
bg="#ffffff";
document.write('<tronmouseover="show(this)"onmouseout="onshow(this)"bgcolor="'+bg+'">');
}
document.write('<td>'+i+'</td>');
i++;
if(i%10==0){
document.write("<tr>");
}
}
document.write("</table>")
varys=null;
functionshow(obj){
ys=obj.bgColor;
obj.bgColor="red";
}
functiononshow(obj){
obj.bgColor=ys;
}
</script>
</body>
</html>
功能很简单,却非常实用,小伙伴们参考下吧。
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短