使用css交换表单背景色

来源:互联网 发布:jquery 将数组清空 编辑:程序博客网 时间:2024/04/29 08:15

这是一个非常简单的,css和html结合的效果,,下面是代码

先来定义样式表

<style>

.cellColor { BACKGROUND:E6E7E8;}
.cellChangeColor{ BACKGROUND:#939598;}

</style>

下面使用表单调用样式表,这样就简单完成了这个功能的使用

<table cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">

<tr class="cellColor" onmouseover=this.className='cellChangeColor' onMouseOut=this.className='cellColor'>
<td height=20 width="135" align="center">第一个
</td>
</tr>
<tr class="cellColor" onmouseover=this.className='cellChangeColor' onMouseOut=this.className='cellColor'>
<td height=20 width="135" align="center">第二个
</td>
</tr>
<tr class="cellColor" onmouseover=this.className='cellChangeColor' onMouseOut=this.className='cellColor'>
<td height=20 width="135" align="center">第三个
</td>
</tr>
<tr class="cellColor" onmouseover=this.className='cellChangeColor' onMouseOut=this.className='cellColor'>
<td height=20 width="135" align="center">第四个
</td>
</tr>

<table>

原创粉丝点击