首页 应用 游戏 资讯 攻略

Dreamweaver表格以及列表隔行换色的js效果

时间:2011-07-06 关注公众号 来源:网络

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>表格隔行换色</title>
  <style type="text/css" media="screen">
  <!-- /* PR-<a class="channel_keylink" href="" target="_blank">CSS</a> */
  table {border-collapse:collapse;border:solid #999;border-width:1px 0 0 1px;}
  table td {border:solid #999;border-width:0 1px 1px 0;}
  .t1 {background-color:#fff;}/* 第一行的背景色 */
  .t2 {background-color:#eee;}/* 第二行的背景色 */
  .t3 {background-color:#ccc;}/* 鼠标经过时的背景色 */
  -->
  </style>
  </head>
  <body>
  <ul><li>11111111</li>
  <li>222222222</li>
  <li>3333333</li>
  <li>444444444</li>
  </ul>
  <script type="text/javascript">
  <!--
  var Ptr=document.getElementsByTagName("li");
  function $() {
  for (i=1;i<Ptr.length+1;i++) {
  Ptr[i-1].className = (i%2>0)?"t1":"t2";
  }
  }
  window.onload=$;
  for(var i=0;i<Ptr.length;i++) {
  Ptr[i].onmouseover=function(){
  this.tmpClass=this.className;
  this.className = "t3";
  
  };
  Ptr[i].onmouseout=function(){
  this.className=this.tmpClass;
  };
  }
  //-->
  </script>
  </body>
  </html>

阅读全文
扫码关注“ 多特资源库
更多更全的软件资源下载
文章内容来源于网络,不代表本站立场,若侵犯到您的权益,可联系我们删除。(本站为非盈利性质网站)
玩家热搜

相关攻略

正在加载中
版权
版权说明

文章内容来源于网络,不代表本站立场,若侵犯到您的权益,可联系我们删除。(本站为非盈利性质网站)

电话:13918309914

QQ:1967830372

邮箱:rjfawu@163.com

toast