读书人

简单的JS有关问题,送分

发布时间: 2012-01-20 18:53:53 作者: rapoo

简单的JS问题,送分
<script>
function On_M(obj)
{
obj.style.background= 'images/r04.gif ';
}
function On_O(obj)
{
obj.style.background= 'images/r03.gif ';
}
</script>
<div onmousemove= "On_M(this); " onmouseout= "On_O(this); " style= "background-image:url( 'images/r03.gif '); width:149px; height:27px; margin-top:1px; " >
</div>

这样子为啥出错...
obj.style.background=url( 'images/r04.gif ');也是错


[解决办法]
function On_M(obj)
{
obj.style.backgroundImage= 'url(images/r04.gif) ';
}
function On_O(obj)
{
obj.style.backgroundImage= 'url(images/r03.gif) ';
}


这样估计也可以
{
obj.style.backgroundImage= "url( 'images/r04.gif ') ";

读书人网 >asp.net

热点推荐