Ff ie compatibility modification Summary

Source: Internet
Author: User

1. If an html Tag is set to $ (id) or getElementById, you must add the id attribute to the tag. IE and FF are compatible. For example, $ (mobile): If the input of mobile does not have the id attribute, the variable undefined will be reported in FF;
2. Take a tag object in the form. If you want IE and FF compatibility, change formMain. item to document. formName. item.
For example, change form1.webUrl to document. form1.webUrl.
If form is passed to a function as a parameter, add "document.", for example, search (formMain) to search (document. formMain)
3. Use obj. attributeName to change the custom attribute of html to obj. getAttribute ("attributeName") to get IE and FF compatible; non-Custom Attributes can still follow
Obj. attributeName.
For example, <input type = "text" name = "memberCn" checkValue = "notNull; eLength: 25"> the checkValue attribute in this tag is a custom attribute and uses obj. getAttribute ("checkValue") is compatible with IE and FF. Other attributes such as type can still use obj. type
4. the eval function is used differently in FF and IE. When "+" is used in FF to connect an executable statement as the eval parameter, it cannot be executed but can be used in IE. When using eval, try to use another method instead.
For example: eval ("msg _" + textbox. name + ". className = 'wrong '");
"Msg _" + textbox. name + ". className = 'wrong 'is used as the eval parameter in IE. In FF, "msg _" + textbox. the space name obtained by name connection is undefined and cannot be executed. You need to modify it:
Document. getElementById ("msg _" + textbox. name). className = 'wrong ';
5. The display attribute block in the style can be blank if an exception occurs in FF. For example, item. style. display = "block" can be changed to item. style. display = ""
For example, $ ("divType4"). style. display = "block ";
Change to $ ("divType4"). style. display = "";
6. add another one: label in FF seems to be different from IE: for example, the following code:
<Td colspan = "3" class = "line_l"> adult <label>
<Input name = "amount" type = "text" value = "$ {amount}" size = "6" maxlength = "10" eleName = "[Adult booking count]" checkValue = "notNull; eLength: 10; isLong "/>
Human and children
<Input name = "kidAmount" type = "text" value = "$ {kidAmount}" size = "6" maxlength = "10" eleName = "[Children booking count]" checkValue = "notNull; eLength: 10; isLong "/>
<Span class = "line_red"> * </span> </label>
</Td>
In this way, when the child's cursor is written in FF, it will always go to the adult, and IE won't, but it won't:
<Td width = "25%"> adult <label>
<Input name = "amount" type = "text" value = "$ {amount}" size = "6" maxlength = "10" eleName = "[Adult booking count]" checkValue = "notNull; eLength: 10; isLong "/> People </label> </td>
<Td width = "75%"> children <label> <input name = "kidAmount" type = "text" value = "$ {kidAmount}" size = "6" maxlength =" 10 "eleName =" [Children booking count] "checkValue =" notNull; eLength: 10; isLong "/> People </label> </td>
Note the label location. One is outside two inputs and the other is outside one input,
Cannot a label contain two input tags in FF ???
The Code is as follows:
<Td> <label>
<Select name = "provinceId" id = "provinceId" onchange = "iniCity (document. frmMain. provinceId, document. frmMain. cityId, document. frmMain. subCity); "eleName =" [province] "checkValue =" IS_LONG ">
</Select> Save
<Select name = "cityId" id = "cityId" onchange = "iniSubCity (document. frmMain. provinceId, document. frmMain. cityId, document. frmMain. subCity); "eleName =" [City] "checkValue =" IS_LONG "> </select> City
<Select name = "subCity" id = "subCity" eleName = "[County]" checkValue = "IS_LONG"> </select>
<Span class = "red"> * </span> </label> </td>
In this Code, the cursor of the second and third select cannot be fixed. It should have ran to the first select, but it is not visible because it is select, but the input above can be seen. This problem is also normal in IE. I think this also illustrates my above statement.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.