Just see a good article about JS call CSS properties, (^_^) Good! Forgive oneself forget, sum up
1, for no underlined CSS properties are generally directly using style. Property name.
such as: Obj.style.margin,obj.style.width,obj.style.left,obj.style.position and so on.
2, for the CSS attribute with the underline, remove each underline and capitalize the first character after each underline.
such as: Obj.style.margintop,obj.style.borderleftwidth,obj.style.zindex,obj.style.fontfamily and so on.
Because float is a reserved word for JavaScript, how do you write float in a style sheet in JS?
We cannot use obj.style.float directly, so the operation is invalid.
The correct way to use it is: IE:obj.style.styleFloat, other browsers Mozilla (Gecko), FF and other styleFloat:obj.style.cssFloat.
Give an example to let everyone understand:
Copy Code code as follows:
<div onclick= "alert (this.style.float);
This.style.float= ' left ';
alert (this.style.float); " > Test 1</div>
<div onclick= "alert (this.style.float);
if (this.style.cssFloat) {this.style.cssfloat= ' left ';
}else{this.style.stylefloat= ' left ';
}alert (this.style.float); " > Test 2</div>