1, float:
IE Syntax: <br/> document. getelementbyid ("Header "). style. stylefloat = "Left"; <br/> Firefox Syntax: <br/> document.getelementbyid(?header=}.style.css float = "Left ";
2. javascript can easily obtain and modify the CSS style of an object through object. style. Property, which is limited to inline styles.
IE Syntax: <br/> var myobject = document. getelementbyid ("Header"); <br/> var mystyle = myobject. currentstyle. backgroundcolor; <br/> Firefox Syntax: <br/> var myobject = document. getelementbyid ("Header"); <br/> var mycomputedstyle = document. defaultview. getcomputedstyle (myobject, null); <br/> var mystyle = mycomputedstyle. backgroundcolor;
3. class attributes
IE Syntax: <br/> var myobject = document. getelementbyid ("Header"); <br/> var myattribute = myobject. getattribute ("classname"); <br/> Firefox Syntax: <br/> var myobject = document. getelementbyid ("Header"); <br/> var myattribute = myobject. getattribute ("class ");
4. Obtain the "for" attribute of the label.
IE Syntax: <br/> var myobject = document. getelementbyid ("mylabel"); <br/> var myattribute = myobject. getattribute ("htmlfor"); <br/> Firefox Syntax: <br/> var myobject = document. getelementbyid ("mylabel"); <br/> var myattribute = myobject. getattribute ("");
5. Obtain the cursor position
IE Syntax: <br/> var mycursorposition = [0, 0]; <br/> mycursorposition [0] = event. clientx; <br/> mycursorposition [1] = event. clienty; <br/> Firefox Syntax: <br/> var mycursorposition = [0, 0]; <br/> mycursorposition [0] = event. pagex; <br/> mycursorposition [1] = event. pagey;
6. Obtain the size of the window or browser window.
IE Syntax: <br/> var mybrowsersize = [0, 0]; <br/> mybrowsersize [0] = document.doc umentelement. clientwidth; <br/> mybrowsersize [1] = document.doc umentelement. clientheight; <br/> Firefox Syntax: <br/> var mybrowsersize = [0, 0]; <br/> mybrowsersize [0] = Window. innerwidth; <br/> mybrowsersize [1] = Window. innerheight;
7. Alpha transparency
IE Syntax: <br/> var myobject = document. getelementbyid ("myelement"); <br/> myobject. style. filter = "alpha (opacity = 80)"; <br/> Firefox Syntax: <br/> var myobject = document. getelementbyid ("myelement"); <br/> myobject. style. opacity = 0.5 ″;
To: http://www.rainweb.cn/article/232.html