onmouseover: expression(onmouseover=function (){this.style.borderColor ='';
this.style.color='';this.style.backgroundColor ='#99E2FB'});
onmouseout: expression(onmouseout=function (){this.style.borderColor='';
this.style.color='';this.style.backgroundColor =''});
background-color:#00BFFF;简单实用,这样在你更换样式的时候就不必再动程序页面,一个CSS搞掂
<style type="text/css">
.JsInCss{
event:expression(
onmouseover = function()
{
this.style.backgroundColor='#f0f0f0'
sotuku.style.display=''
},
onmouseout = function()
{
this.style.backgroundColor='#ffffff'
sotuku.style.display='none'
}
)
}
</style>
CSS与JS结合实现鼠标悬停效果
本文介绍了一种利用CSS和JavaScript结合的方式实现网页元素的鼠标悬停交互效果的方法。通过简单的代码示例展示了如何改变元素背景颜色等属性,并保持页面样式的灵活性。
2354

被折叠的 条评论
为什么被折叠?



