把onmouseover事件的变化直接写在.css样式
一般的写法是直接在页面元素的标签里面写以下这样的代码:
onmouseover="this.style.backgroundColor='#FFFFFF'" onmouseout="this.style.backgroundColor='#000000'"
请问可不可以用符合w3c标准的语法,把onmouseover事件的变化直接写在.css样式表里面?
1楼
<style type="text/css">
.showCSS{
event:expression(
onmouseover = function()
{
this.style.backgroundColor='#f0f0f0'
},
onmouseout = function()
{
this.style.backgroundColor='#ffffff'
}
)
}
</style>
<div class="showCSS">把鼠标放上去试试看!:)</div>
2楼
楼上正解,
3楼
expression
4楼
Thank you, 改CSS去咯
没有评论:
发表评论