常用表格交替效果

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script language="javascript">
window.onload = function() {
    doubleBgColor(document.getElementById("table1"),"#cccccc","#ffcccc")
 
}

function doubleBgColor(Table,Bg1,Bg2) {
    for (var i=0;i<Table.rows.length;i++) Table.rows[i].bgColor=i%2?Bg2:Bg1;
}
</script>
</head>

<body>
<table border="0" cellpadding="1" cellspacing="1" id="table1" width="500" bgcolor="#000000">
    <TR><TD>单 数行 </TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
</table>
<table><tr><td width="100" height="100" onmouseover="style.backgroundColor='#C86F70'" onmouseout="style.backgroundColor='#DDC676'" bgcolor="#DDC676">ihandu</td></tr></table>
</body>
</html> 

<style>
th {font-weight: normal; text-align:left; background: #CCCCCC}
td {background: #ffffff}
body{background:#000000}
</style>

<table>
<tr>
<th>Color First</th>
</tr>
<tr>
<td>Color Second</td>
</tr>
<tr>
<th>Color First</th>
</tr>
<tr>
<td>Color Second</td>
</tr>
<tr>
<th>Color First</th>
</tr>
<tr>
<td>Color Second</td>
</tr>
</table>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值