js Let us learn from the basics together, and we learn little by little
Below is the code I wrote, and then everyone can read it! ! !
The code copy is as follows:
<html>
<head>
<title>js demo</title>
</head>
<body>
<script>
document.write('<table align="center">');
var i=0;
while(i<100){
if(i%10==0){
if(i%20==0)
bg="#cccccccc";
else
bg="#ffffffff";
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>
The function is very simple, but it is very practical. Please refer to it.