如何用JS写鼠标触发事件 鼠标js 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不需要js设置事件,只用CSS就行<style type="text/css">td:hover { background:#ccffff; }</style>---------------------------------------<table> <tr> <td>我是第一行第一列</td> <td>我是第一行第二列</td> <td>我是第一行第三列</td> </tr> </table> <table> <tr> <td onmouseover="this.style.background='#888'" onmouseout="this.style.background=''">我是第一行第一列</td> <td onmouseover="this.style.background='#888'" onmouseout="this.style.background=''">我是第一行第二列</td> <td onmouseover="this.style.background='#888'" onmouseout="this.style.background=''">我是第一行第三列</td> </tr></table> 1L代码简单,但不兼容低版本浏览器,好像IE8以下无效2L代码兼容所有浏览器,就是写在html里面麻烦了点。var tds = document.getElementsByTagName('td');for(var i=0;i<tds.length;i++){ tds[i].onmouseover = function(){ this.style.background = 'red' } tds[i].onmouseout = function(){ this.style.background = '' }} 在一列中再嵌入两列怎么做 问个简单js操作iframe的问题 js中对象赋值的问题 请问用jquery怎样获取远程html中body>div的个数? dwr.jar 文件里面的Util.js编辑后打jar包不可用 String.prototype问题 关于jquery的each方法 关于session混乱问题 如何在html中调用js 一个不显眼的问题 如何读取网页的源码 如何把数据在jsp页面实现降序排列
td:hover { background:#ccffff; }
</style>
---------------------------------------
<table>
<tr>
<td>我是第一行第一列</td>
<td>我是第一行第二列</td>
<td>我是第一行第三列</td>
</tr>
</table>
<tr>
<td onmouseover="this.style.background='#888'" onmouseout="this.style.background=''">我是第一行第一列</td>
<td onmouseover="this.style.background='#888'" onmouseout="this.style.background=''">我是第一行第二列</td>
<td onmouseover="this.style.background='#888'" onmouseout="this.style.background=''">我是第一行第三列</td>
</tr>
</table>
2L代码兼容所有浏览器,就是写在html里面麻烦了点。var tds = document.getElementsByTagName('td');
for(var i=0;i<tds.length;i++){
tds[i].onmouseover = function(){
this.style.background = 'red'
}
tds[i].onmouseout = function(){
this.style.background = ''
}
}