All css2properties objects accessed through JS follow the following syntax:
Document. getelementbyid ("ID"). style. Property = "value ";
Some properties are different from those in CSS. The general rules are as follows:
(1) The attribute name represented by a word in CSS remains unchanged. If the name contains a hyphen (-), the hyphen (-) is removed and the subsequent words are capitalized. The overall naming principle is the Hungarian naming method. For example: Background-color: red; in JS, write Dom. style. backgroundcolor = "red ";
(2) For float, it is the same as the type flaot in JS, so it is changed to cssfloat, and others remain unchanged.
Categories:
For details, refer to the list in w3school, address: http://www.w3school.com.cn/htmldom/dom_obj_style.asp
Refer to the above address, I made a simple JS testing tool, address: http://js.ecjtu.net/, when you are not sure, you can use this test.