IE7 SetAttribute "Turn"

Source: Internet
Author: User

Class and ClassName Compatibility methods:

Object.setattribute ("Class", "content")

Can be set successfully in IE8, Chrome, Firefox, Opera10, but cannot be set under IE7.

Object.setattribute ("ClassName", "content")

Only IE7 can be set successfully, but other browsers cannot.

Compatibility method:

Use object.classname= "Content"

Style and Csstext compatibility methods:

Object.setattribute ("Style", "position:absolute;left:10px;top:10px;")

Can be set successfully in IE8, Chrome, Firefox, Opera10, but cannot be set under IE7.

Object.setattribute ("Csstext", "position:absolute;left:10px;top:10px;")

This setting method is not supported by all browsers.

Compatibility method:

Use object.style.csstext= "position:absolute;left:10px;top:10px;"

or separate object.style. Each property is set individually.

Firefox and IE JS compatibility: Set element style familiar

Under IE, the object, collection and event properties of the SetAttribute set element are only used as normal properties, but can be assigned directly, as follows:

var csstext = "font-weight:bold;color:red;"
Use the following for Firefox type browser
Element.setattribute ("style", csstext);

The following wording is used for IE type browser
Element.style.cssText = Csstext;

IE7 SetAttribute "Turn"

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.