页面里有这个:<img src="1.jpg" onmouseover="aaa();" />
我把鼠标移动的图片上,鼠标不动,再按F5刷新页面,aaa()就不执行了,必须动下鼠标。
一是鼠标指针在图片上,二是鼠标未移动,在这种情况下怎么让aaa()执行呢?
感谢。

解决方案 »

  1.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
     </head>
    <script type="text/javascript">
    function a(){ alert("hello world");
    }
    </script>
     <body onload="a();">
      <img src="1.jpg" onmouseover="a();"/>
     </body>
    </html>
      

  2.   

    JS 有手动触发事件的方法,如
    IE:document.getElementById('imageId').fireEvent('onmouseover')
    Firefox:document.getElementById('b1').attachEvent('mouseover')更详细的的可以直接在 GOOGLE 中搜索 手动触发JS事件
      

  3.   

    感谢hemingwang0902,感谢anglechengd。