First, use JS Operation CSS the notation of the property
1 , for non-underlined CSS properties are generally used directly style. property name.
such as: Obj.style.margin , Obj.style.width , Obj.style.left , obj.style.position
2 , for those containing the underlined CSS attribute, remove each underline and change the first character after each one to uppercase.
such as: Obj.style.marginTop , Obj.style.borderLeftWidth , Obj.style.zIndex , obj.style.fontFamily wait
3 , JS Operation CSS Float special wording for attributes
because float is a JavaScript reserved words, we cannot directly use obj.style.float to use, so the operation is not valid. The correct way to use it is:IE:obj.style.styleFloat, other browsers Mozilla (Gecko), FF , etc. with styleFloat:obj.style.cssFloat.
Second, use JS Get CSS Property Value
1 , get in-line Style : Obj.style. property name. <div id= "css88" class= "ss" style= "width:200px; height:200px; background: #333333" >js get CSS Property Value </div> Cannot access class .
2 , Get Class internal and Link outside the Css Properties: IE is used in the obj.currentstyle[" property name "] method, and FF it's used. getComputedStyle Method
third, the use JS Give CSS Property Assignment Value
1 , Assignment class Properties
Assignment Value: document.getElementById (' Ceil '). ClassName = "Class1";
if it has multiple values: document.getElementById (' Ceil '). ClassName = "Class1 class2 class3";
2 , Obj.style.cssText sets an object's CSS style
document.getElementById (' navition '). Style.csstext = " you a CSS Code ';
JavaScript Dynamic Operation CSS Summary