补充:
在IE,Opera下正常运行;可是在火狐下不运行,也不报错啊。

解决方案 »

  1.   

    function abc() 

    alert(); 

    这里弹出的内容为空,firefox不会执行;IE里可以
      

  2.   

    2 楼正解,
    function abc() 

    alert(); 
    } 如果 在abc() 方法中alert("ff");
    这样就可以了.
    lz 试试吧.
      

  3.   


    <html> 
    <head> 
    <script type="text/javascript"> 
    function myload() 

    var Ka=navigator.userAgent.toLowerCase(); 
    var rt=Ka.indexOf("opera")!=-1; 
    var IsIE=Ka.indexOf("msie")!=-1&&(document.all&&!rt); 
    if(IsIE){//IE
    document.getElementById("but").attachEvent("onclick",abc); 
    }else{//FF
    document.getElementById("but").addEventListener("click",abc,false); 
    }
    } function abc() 

    alert('s'); 

    </script> 
    </head> <body onload="myload()"> 
    <input type="button" id="but" value="ddd"/> 
    </body> 
    </html>
      

  4.   

    <html> 
    <head> 
    <script type="text/javascript"> 
    function abc() 

    alert(""); 
    } function myload() 

    document.getElementById("but").onclick=abc;
    } </script> 
    </head> <body onload="myload()"> 
    <input type="button" id="but" value="ddd"> 
    </body> 
    </html>
    试试