<!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.0 transitional//EN">
<HTML>
<HEAD>
<TITLE> CSS样式里使用JavaScript(onmouseover/onmouseout) </TITLE>
<style type="text/css">
li{
cursor:pointer;
border:1px solid #eee;
/*设置onmouseover事件*/
onmouseover:expression(onmouseover=function (){this.style.borderColor ='blue';this.style.color='red';this.style.backgroundColor ='yellow';this.style.fontWeight='bold'});
/*设置onmouseout事件*/
onmouseout:expression(onmouseout=function (){this.style.borderColor='';this.style.color='';this.style.backgroundColor ='';this.style.fontWeight=''});
}
/*使火狐浏览器实现相应效果*/
li:hover{
background:yellow;
color:red;
border-color:blue;
font-weight:bold;
}
</style>
</HEAD>
<BODY>
<ul>
<li>我是第一行列表</li>
<li>我是第二行列表</li>
<li>我是第三行列表</li>
<li>我是第四行列表</li>
<li>我是第五行列表</li>
</ul>
</BODY>
</HTML>
<font color="red">注:火狐是不支持expression的,而且expression也比较占资源,建议改为js实现!</font>
<div style="position:absolute;height:12px;left:0; top:expression(document.body.clientHeight- this.style.pixelHeight+document.body.scrollTop);font:12px;">IE里我永远在左下角。^o^</div>