求解一段ie与firefox中的脚本差异window.onload = function ff()
 {
 alert('YYY');
 if (navigator.appName != 'Microsoft Internet Explorer')
 {
 alert('FF');
 window.forward(1);
 }
 else
 {
 alert('IE');
 history.forward(1);
 }
 }
window.location= 。为什么这样操作之后‘FF’和“IE”不能alert出来了呢?而且在firefox中不起作用,在ie中起作用.
请高人指点。

解决方案 »

  1.   

    function   ff()
     {
        alert('YYY');
        if   (navigator.appName   !=   'Microsoft   Internet   Explorer')
        {
            alert('FF');
            window.forward(1);
        }
        else
       {
           alert('IE');
           history.forward(1);
       }

    window.onload   =   ff;试一试呢?!
      

  2.   

    window.event只能在IE下运行,而不能在Firefox下运行,这是因为Firefox的event只能在事件发生的现场使用.
    解决方法:
    IE:
    <input name="Button8_1" type="button" value="IE" onclick="javascript:gotoSubmit8_1()"/>
    ...
    <script language="javascript">
    function gotoSubmit8_1() {
    ...
    alert(window.event); //use window.event
    ...
    }
    </script>
    IE&Firefox:
    <input name="Button8_2" type="button" value="IE" onclick="javascript:gotoSubmit8_2(event)"/>
    ...
    <script language="javascript">
    function gotoSubmit8_2(evt) {
    ...
    evt=evt?evt:(window.event?window.event:null);
    alert(evt); //use evt
    ...
    }
    </script>
    http://www.yongfa365.com/Item/JavaScript-In-IE-Firefox.html