找回密码
 立即注册
搜索
热搜: 生活 中国

输出1000个格子

[复制链接]
admin 发表于 2013-10-6 21:55:39 | 显示全部楼层 |阅读模式
输出1000个格子

 

  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  4. <title>输出1000个格子</title>
  5. </head>
  6. <body>
  7. <script type="text/javascript">
  8. document.write('<table border="1" width="100%" align="center">');
  9. var i=0;
  10. while(i<1000){
  11. if(i%10==0)
  12. {
  13. if(i%20==0)
  14. bg="#cccccc";
  15. else
  16. bg="#ffffff";
  17. document.write('<tr onmouseover="show(this)" onmouseout="noshow(this)" bgcolor="'+bg+'">');
  18. }
  19. //输出1000个格子
  20. document.write('<td>'+i+'</td>');
  21. i++;
  22. if(i%10==0)
  23. document.write('</tr>');
  24. }
  25. document.write('</table>');
  26. var ys=null
  27. function show(obj){
  28. ys=obj.bgColor;
  29. obj.bgColor="red";
  30. }
  31. function noshow(obj){
  32. obj.bgColor=ys;
  33. }
  34. </script>
  35. </body>
  36. </html>
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生活导航|生活导航 ( 新ICP备12003026-1号 )

GMT+8, 2024-5-9 18:14 , Processed in 0.108180 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表