2008年06月3日 20:08 | 作者:giky
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br/><html xmlns="http://www.w3.org/1999/xhtml"><br/><head><br/><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><br/><title>表格隔行换色</title><br/><style type="text/css" media="screen"><br/><!-- /* PR-CSS */<br/>table {border-collapse:collapse;border:solid #999;border-width:1px 0 0 1px;}<br/>table td {border:solid #999;border-width:0 1px 1px 0;}<br/>.t1 {background-color:#fff;}/* 第一行的背景色 */<br/>.t2 {background-color:#eee;}/* 第二行的背景色 */<br/>.t3 {background-color:#ccc;}/* 鼠标经过时的背景色 */<br/>--><br/></style><br/></head><br/><body><br/><ul><li>11111111</li><br/><li>222222222</li><br/><li>3333333</li><br/><li>444444444</li><br/></ul><br/><script type="text/javascript"><br/><!--<br/>var Ptr=document.getElementsByTagName("li");<br/>function $() {<br/> for (i=1;i<ptr.length+1;i++) { <br/> Ptr[i-1].className = (i%2>0)?"t1":"t2"; <br/> }<br/>}<br/>window.onload=$;<br/>for(var i=0;i<ptr.length;i++) {<br/> Ptr[i].onmouseover=function(){<br/> this.tmpClass=this.className;<br/> this.className = "t3";<br/> <br/> };<br/> Ptr[i].onmouseout=function(){<br/> this.className=this.tmpClass;<br/> };<br/>}<br/>//--><br/></script><br/></body><br/></html>
提示:你可以先修改部分代码再运行。
发表评论(评论暂缺) 分类:代码相关
姓名: *必填
邮件: *必填 (不会被公开)
网站: