用CSS来设置onmouseover事件实例:
ul{
/*设置onmouseover事件*/
onmouseover: expression(onmouseover=function (){this.style.borderColor =’#cccccc’;this.style.color=’#ffffff’;this.style.backgroundColor =’#0099ff’});
/*设置onmouseout事件*/
onmouseout: expression(onmouseout=function (){this.style.borderColor=”;this.style.color=”;this.style.backgroundColor =”});
background-color:#ffffff;
}
这段代码实现的功能就是当鼠标移动到ul列表时,背景就会变成蓝色,文字变成白色,边框变成灰色.这种效果一般用在当用UL代替表格时,实现的当整行变换效果!
顶一个,不错,学习了~~~
评论 by lrj — 2009年6月17日 @ 09:13
td:hover{
background-color:#3366CC;
}
http://www.phplovers.com/html/wangyesheji/2009/0627/onmouseover_onmouseout.html
评论 by ayanmw — 2010年9月2日 @ 11:16
hover for FireFox only
expression for IE only
评论 by ayanmw — 2010年9月2日 @ 11:18