function parameter, when the number of arguments is variable, you can use arguments
Arguments.length= Number of arguments
To get a CSS style method:
The getComputedStyle () method----> Gets the computed style of the computer (the final style after several changes), IE 6 7 8 is compatible
Style. Properties-----> Operations are element inline styles, resulting in attributes that are inline styles
Currentstyle-----> Standard Browser not compatible
Attention:
You cannot get a composite style. Example: Backgroud:url () color ....
A single style should not be used for judgment.
Do not have spaces
Do not get a style that is not set: incompatible
Dealing with compatibility cases:
if ($ (' Div1 '). Currentstyle) {
$ (' Div1 '). Currentstyle.width;
}else{
getComputedStyle ($ (' Div1 ')). width;
}
Using the function:
function GetStyle (obj,attr) {
Return Obj.currentstyle? Obj.currentstyle[attr]:getcomputedstyle (obj) [attr];
}
JS function arguments and get CSS style method