日期:2014-05-17  浏览次数:20616 次

DIV 为什么不能响应鼠标消息onmousemove一类的
DIV 为什么不能响应鼠标消息onmousemove一类的??

------解决方案--------------------
HTML code

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="gb2312" />
        <title></title>
        <style>
        </style>
    </head>
    <body>
        <div style="margin: 50px; width:300px; height:300px; border:1px solid red;" id="a">
        </div>
        <script>
            function $(el){
                return typeof el == 'string' ? document.getElementById(el) : el;
            }
            $('a').onmousemove=  function(){
                this.innerHTML += '哈哈'
            }
        </script>
    </body>
</html>

------解决方案--------------------
很简单:
HTML code

<div style="margin: 50px; width:300px; height:300px; border:1px solid red;" onmouseover="this.innerHTML='Game Over'" onmouseout="this.innerHTML=''">

------解决方案--------------------
可以的。你是怎么做的?可以把你的代码贴出来,看看什么地方出了问题
------解决方案--------------------
有些事件ff和IE相应的不一样吧