老来打扰你们还真不好意思 下面是版主大神给的代码 被我修改后事件的乱了 这个是为什么
<a onmouseOver="mouse(1)" onmouseout="mouse(1)">a</a> 
<script type="text/javascript">     
function mouse(e) {         
if (e.type  == 'mouseover')  //为什么显示结果都是移除鼠标        
alert("鼠标移进")         
else             
alert("鼠标移出")     

</script>

解决方案 »

  1.   


    (e=1).type 肯定不会等于mouseover,应该是undefined,那样的话, 当然会走入esle 分支, 那肯定是鼠标移出了为啥要给mouse传一个参数mouse(1)??
      

  2.   

    因为在其他的代码中 我需要给mouse传一个参数mouse(1) 求高手帮帮忙啊~ 
      

  3.   

    <a onmouseOver="mouse(event)" onmouseout="mouse(event)">a</a> 
    <script type="text/javascript">     
    function mouse(e) {         
    if (e.type  == 'mouseover')  //为什么显示结果都是移除鼠标        
    alert("鼠标移进")         
    else             
    alert("鼠标移出")     

    </script>
    你改成这样试试
      

  4.   

    那样是可以 但是我的a标签想要这样的 <a onmouseOver="mouse(1)" onmouseout="mouse(1)">a</a>
      

  5.   


    改成: mouse(event,1) 不行吗?
      

  6.   

    我自己修改成这样了 有错误吗
    <a onmouseOver="mouse(event,1)" onmouseout="mouse(event,1)">a</a> 
    <script type="text/javascript">     
    function mouse(e,r) {
    alert(r);
    if (e.type  == 'mouseover')   
    alert("鼠标移进")         
    else             
    alert("鼠标移出")     

    </script>
      

  7.   


    可以啊,多传递几个参数都行,主要event对象传递进去就行了,循序不一定按照原来的
      

  8.   

    首先,你要知道event事件在各种浏览器中是不一样的,如果你用的ie,在任何地方都可以调用,因为window.event是全局变量,如果在firefox或者chrome中,你可以用
    onmouseover=“function(evt){mouse(evt,canshu);}”即可。基础知识很重要啊