js让我们一起从基础来学习,我们一点一点的来学习
下边是我写的代码,然后大家看着学习下吧!!!
<html>
<head>
<title>js演示</title>
</head>
<body>
<script>
document.write(\'<table border=\"1\" width=\"100px\" align=\"center\">\');
var i=0;
while(i<100){
if(i%10==0){
if(i%20==0)
bg=\"#cccccc\";
else
bg=\"#ffffff\";
document.write(\'<tr onmouseover=\"show(this)\" onmouseout=\"onshow(this)\" bgcolor=\"\'+bg+\'\">\');
}
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 onshow(obj){
obj.bgColor=ys;
}
</script>
</body>
</html>
功能很简单,却非常实用,小伙伴们参考下吧。
本文地址:https://www.stayed.cn/item/7557
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我