SoFunction
Updated on 2025-04-12

The differences between JavaScript and the implementation method of IE and Firefox


question

Note: Under IE or Firefox2, it can be used or; under Firefox1, it can only be used.
Solution: Use instead.

12. Modal and non-modal window problems

Note: Under IE, modal and non-modal windows can be opened through showModalDialog and showModelessDialog; under Firefox, it cannot.
Solution: Use (pageURL, name, parameters) to open a new window directly. If you need to pass parameters in the child window back to the parent window, you can use it in the child window to access the parent window. For example: var parWin = ; ("Aqing").value = "Aqing";

question

The following frame is an example:
<frame src="" name="frameName" />

(1) Access the frame object:
IE: Use or access this frame object.
Firefox: Only use this frame object to access.
In addition, both IE and Firefox can use ("frameId") to access this frame object.

(2) Switch frame content:
In both IE and Firefox, you can use ("testFrame").src = "" or = "" to switch the content of the frame.

If you need to pass parameters in the frame back to the parent window, you can use parent in the frame to access the parent window. For example: .="Aqing";

question

Firefox's body exists before the body tag is fully read in by the browser; while IE's body must exist after the body tag is fully read in by the browser.

For example:
Firefox:
<body>
<script type="text/javascript">
= function(evt){
evt = evt || ;
alert(evt);
}
</script>
</body>
IE&Firefox:
<body>
</body>
<script type="text/javascript">
= function(evt){
evt = evt || ;
alert(evt);
} </script>

15. Event delegate method

IE: = inject; //Function inject() has been implemented before this
Firefox: = inject();
Some people say the standard is:
=new Function('inject()');

16. The difference between firefox and IE (parentElement) parent element

IE:
firefox:
Solution: Because both firefox and IE support DOM, it is a good choice to use it.

:hand VS cursor:pointer

Firefox does not support hand, but ie supports pointer
Solution: Use pointer uniformly

It works properly in IE, but innerText doesn't work in FireFox.

Solution:
if(("Explorer") > -1){

      ('element').innerText = "my text";

} else{

      ('element').textContent = "my text";

}

19. Statements similar to = in FireFox are invalid

Solution:
= + 'px';

20. ie, firefox and other browsers have different operations on table tags. In ie, it is not allowed to assign innerHTML values ​​to table and tr. When using js, using appendChile method does not work.

Solution:
//Add a blank line to the table:
var row = (-1);
var cell = ("td");
= " ";
= "XXXX";
(cell);

21. padding problem

padding 5px 4px 3px 1px FireFox cannot explain the abbreviation, it must be changed to padding-top:5px; padding-right:4px; padding-bottom:3px; padding-left:1px;

22. When eliminating indentation of lists such as ul, ol, etc.

The style should be written as: list-style:none; margin:0px; padding:0px;
Among them, margin attribute is valid for IE, padding attribute is valid for FireFox

23. CSS Transparent

IE:filter:progid:(style=0,opacity=60)。
FF:opacity:0.6。

24. CSS rounded corners

IE: No rounded corners are supported.
FF: -moz-border-radius:4px, or -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px; -moz-border-radius-bottomleft:4px; -moz-border-radius-bottomright:4px;.

25. CSS double-wire concave and convex border

IE:border:2px outset;。
FF: -moz-border-top-colors: #d4d0c8 white;-moz-border-left-colors: #d4d0c8 white;-moz-border-right-colors:#404040 #808080;-moz-border-bottom-colors:#404040 #808080;