I. Contents of operation
1.innerHTML used to set or get object initiation and content within the hormone tag ( identify html tags )
2.innerText used to set or get object initiation and content within the hormone tag (IE)
Textcontent used to set or get object initiation and content within the hormone tag (FF)
3.outerHTML is used to set or get content within the initiation and hormone tags including this object ( identify html tags )
Outertext is used to set or get the contents of the starting and hormone tags including this object
Second, Operation Properties
1. Direct Operation
Object . Properties
Object . Properties = value ( set, GET, add Property ( property value ))
2.
GetAttribute (" property ") Gets the value of the given property
SetAttribute (" Property ", " value ") setting or adding Properties
Three, the Operation style
1. Inline style
Object . style. Properties
Object . style. Properties = value ( set, GET, add Property )
****************************************************
If the attribute is "-" linked, the "-" is removed and the first letter of the following word is capitalized
****************************************************
2.css Cascading Style
1> changing Styles by ID
2> changing Styles with className ( for batch changes )
3> change or get or set the value of a property
document.stylesheets[ subscript ].rules[ subscript ].style. Properties
document.stylesheets[ subscript ].rules[ subscript ].style. Properties = value
Document.stylesheets A collection of style sheets
Document.stylesheets[0].rules List of style rules
Document.stylesheets[0].rules.style collection of style rules
document.stylesheets[ subscript ].rules[ subscript ].style. Properties
Applicable to IE
**************************************************************
document.stylesheets[ subscript ].cssrules[ subscript ].style. Properties
document.stylesheets[ subscript ].cssrules[ subscript ].style. Properties = value
Suitable for FF
***************************************************************
3. Inline style and CSS cascading style common way
object . Currentstyle. Properties IE used to get the actual style properties
getComputedStyle ( object , null) FF to get the actual style properties
*******************************
Can only get cannot set
*******************************
This article is from the "Mr.zhu-Technology Exchange" blog, please be sure to keep this source http://bjishu.blog.51cto.com/7481301/1671810
JavaScript action on the contents, properties, styles of a Document object