用CSS来设置onmouseover和onmouseout事件
用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代替表格时,实现的当整行变换效果!


lrj on 星期三, 17th 六 2009 09:13
顶一个,不错,学习了~~~