如何用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合并的列的例子,有弄过的麻烦发个例子参考下 js动态创建下拉菜单得到的不是我想要的 想自己给别人做网站,有难题,教教我, 请教:当输入框换行的问题。 请教一个javascript小问题 <td><%-- 在这里显示时间(格式为:24小时制:分钟:秒) --%></td>,如何实现?? 如何除掉打开窗口右上角的"最大化,最小化,关闭". 如何获得一个窗口的大小? 动态添加表格tr Extjs4 TreePanel的CheckBox列选中问题 如何读取网页的源码 如何把数据在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 = ''
}
}