超好看的table样式格行换色加单击事件

<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>各行换色+单击表格行变色</title>
<style type="text/ css ">
<!--
#ejiaA1 {
width: 550px;
border-top: #E3E3E3 1px solid;
border-left: #E3E3E3 1px solid;
}
#ejiaA1 td,#ejiaA1 th {
padding: 5px;border-right: #E3E3E3 1px solid;
border-bottom: #E3E3E3 1px solid;
font-size:12px;
height:16px; line-height:16px;
}

#ejiaA1 tr td span {color: #686868}
#ejiaA1 tr td span.st1 {color: #ff0000}
--></style>
<script language="javascript"><!--
function ejiaA1(o,a,b,c,d){
var t=document.getElementById(o).getElementsByTagName("tr");
for(var i=0;i<t.length;i++){
t .style.backgroundColor=(t.sectionRowIndex%2==0)?a:b;
t.οnclick=function(){
if(this.x!="1"){
this.x="1";//本来打算直接用背景 (更多:www.52mvc.com) 色判断,FF获取到的背景是RGB值,不好判断
this.style.backgroundColor=d;
}else{
this.x="0";
this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
t.οnmοuseοver=function(){
if(this.x!="1")this.style.backgroundColor=c;
}
t.οnmοuseοut=function(){
if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
}
--></script>
</head>

<body>

<table width="500" border="0" cellspacing="0" cellpadding="0" id="ejiaA1">
<tbody><tr style="background-color: rgb(255, 255, 255);">
<td colspan="4"><span class="st1"><span><a href="http://52mvc.com" target="_blank">懒人建站</a>收集</span>  当前页:<span>第1页 共2页 </span>  总次数:<span>66</span>  总时长:<span>284小时36分27秒</span></span></td>
</tr>
<tr style="background-color: rgb(245, 245, 245);">
<th>接入方式</th><th>上网时间</th><th>下网时间</th><th>上网时长</th>
</tr>
<tr style="background-color: rgb(255, 255, 255);">
<td>宽带接入</td>
<td>2008-4-23 12:40:18</td>
<td>2008-4-23 14:50:28</td>
<td>2小时10分10秒</td>
</tr>
<tr style="background-color: rgb(245, 245, 245);">
<td>宽带接入</td>
<td>2008-4-23 12:40:18</td>
<td>2008-4-23 14:50:28</td>
<td>2小时10分10秒</td>
</tr>
<tr style="background-color: rgb(255, 255, 255);">
<td>宽带接入</td>
<td>2008-4-23 12:40:18</td>
<td>2008-4-23 14:50:28</td>
<td>2小时10分10秒</td>
</tr>
<tr style="background-color: rgb(245, 245, 245);">
<td>asp.net</td>
<td>2008-4-23 12:40:18</td>
<td>2008-4-23 14:50:28</td>
<td>2小时10分10秒</td>
</tr>
<tr style="background-color: rgb(255, 255, 255);">
<td>宽带接入</td>
<td>2008-4-23 12:40:18</td>
<td>2008-4-23 14:50:28</td>
<td>2小时10分10秒</td>
</tr>
<tr style="background-color: rgb(245, 245, 245);">
<td>宽带接入</td>
<td>2008-4-23 12:40:18</td>
<td>2008-4-23 14:50:28</td>
<td>2小时10分10秒</td>
</tr>
</tbody></table>
<script language="javascript"><!--
//ejiaA1("表格名称","奇数行背景","偶数行背景","鼠标经过背景","点击后背景");
ejiaA1("ejiaA1","#fff","#F5F5F5","#FFFFCC","#FFFF84");

--></script>









</body></html>

来自:http://blog.csdn.net/jhl52771/article/details/8443517

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值