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"