Web page Production WEBJX article introduction: Web Design Issues Summary: IE and Firfox compatibility issues. |
IE and Firefox compatibility issues
1. Document.form.item question
(1) Existing problems:
There are many Document.formName.item ("itemname") statements in existing code that cannot be run under Firefox (Firefox)
(2) Solution:
Switch to document.formname.elements["ElementName"]
2. Collection Class object Problem
(1) Existing problems:
Many collection class objects in existing code use (), IE can accept, Firefox (Firefox) can not.
(2) Solution:
Use [] as the subscript operation instead. Such as:
Another example:
3. Window.event
(1) Existing problems:
Use window.event not to run on Firefox
(2) Solution:
Firefox event can only be used in the scene of the incident, this problem can not be resolved. You can do this:
Original code (can run in IE):
New code (can be run in IE and Firefox):
<input type= "button" Name= "Somebutton" value= "Submit" onclick= "Javascript:gotosubmit" (event)/><br BR/><script language= "javascript" ><br/>function gotosubmit (evt) {<br/>evt = evt? EVT: (Window.ev Ent? Window.event:null); <br/>...<br/>alert (EVT); Use evt<br/>...<br/>}<br/></script>
In addition, if the first line in the new code does not change, the same as the old code (that is, the gotosubmit call does not give the parameter), it still can only run in IE, but not error. Therefore, the TPL part of this scheme is still compatible with the old code.
[1] [2] [3] [4] [5] [6] [7] [8] Next page