1.ObjectProblem 1.1 form object Existing problems: ExistingCodeIn this way, the form object is obtained through document. Forms ("formname"), which is accepted by IE. No. SolutionMethod: Use as subscript. Change to document. Forms ["formname"] Remarks Use In subscript calculation, formname is ID and name 1.2HtmlObject Existing problems: In ie, the ID of the HTML object can be The variable name of the subordinate object of document is used directly. In MF . Document. All ("itemname") or document. All ("Itemid ") Solution: Use the Object ID as the object variable name Document. getelementbyid ("Itemid ") Remarks Document. All is a custom ie method, so try not to use it. Another method is available in both IE and MF. VaR F = Document. Forms ["formname"]; VaR o = f. Itemid; 1.3 Div object Existing problems: In ie, the DIV object can use ID directly as the object variable name. It cannot be in MF. Divid. style. Display = "None" Solution: Document. getelementbyid ("divid"). style. Display = "None" Remarks The getelementbyid method is used to obtain the object, whether it is a div object or not. See 1.2 1.4 About Frame Existing Problems In IE You can use window. testframe to obtain the frame, but not in MF. Solution The main difference between MF and IE in frame usage is: If the following attributes are written in the frame tag: Then Ie can access the window object corresponding to this frame through ID or name. However, MF can only access the window object corresponding to this frame through name. For example, if the above frame label is written in the HTM in the top window, you can access IE: Window. Top. frameid or window. Top. framename to access this window object Mf: only window. Top. framename can access this window object. In addition, both mfand iecan use javasdesktop.doc ument. getelementbyid ("frameid") to access the frame tag. In addition, you can use the parameter top.doc ument. getelementbyid ("testframe"). SRC = 'Xx.htm' to switch the frame content You can also use window. Top. framename. Location = 'Xx.htm' to switch the frame content Window 1.5 Existing Problems In IE, you can use showmodaldialog and showmodelessdialog to open modal and non-modal windows, but MF does not. Solution Use window. Open (pageurl, name, parameters) to open a new window. If you want to pass parameters, you can use frame or IFRAME. 2. Summary 2.1 when defining various object variable names in JS, use ID whenever possible to avoid using name. In ie, the ID of an HTML object can be used as a document Variable names of subordinate objects are directly used. It cannot be used in MF. Therefore, use ID whenever possible to avoid using only name instead of ID. 2.2 variable names and an HTML Object Issues with the same ID Existing Problems In MF, because the Object ID is not the name of the HTML object, you can use the same variable name as the HTML Object ID, ie . Solution When declaring variables, add VaR to avoid ambiguity, so that it can run normally in IE. In addition, it is best not to obtain the ID of an HTML Object The same variable name to reduce errors. 1. Document. All Firefox is compatible with document. All, However, a warning is generated. You can use getelementbyid ("*") or Instead of getelementbytagname ("*) However, attributes such as document. All. length are completely incompatible. 2. Parentelement This is also incompatible. For example, obj. parentelement. name should be changed OBJ. parentnode. Attributes. getnameditem ("name"). nodevalue (I don't know how to write it more concisely) 3. Event W3C does not support windows. Event For example: In IE |