JS let us learn from the basics together, let’s learn bit by bit
The following is the code I wrote, and everyone can watch and learn from it! ! !
js demo
<script><br>
document.write('<table border="1" width="100px" align="center">');<br>
var i=0;<br>
while(i<100){<br />
if(i ==0){<br />
if(i ==0)<br />
bg="#cccccc";<br />
else<br />
bg="#ffffff";<br />
document.write('<tr onmouseover="show(this)" onmouseout="onshow(this)" bgcolor="' bg '">');<br>
}<br>
document.write('<td>' i '</td>');<br>
i ;<br>
if(i ==0){<br>
document.write("<tr>");<br>
}<br>
}<br>
document.write("</table>")<br>
var ys=null;<br>
function show(obj){<br>
ys=obj.bgColor;<br>
obj.bgColor="red";<br>
}<br>
function onshow(obj){<br>
obj.bgColor=ys;<br>
}<br>
</script>
The function is very simple, but very practical. Friends, please refer to it.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn