<Head runat = "server">
<Title> </title>
<Style type = "text/CSS">
# Btn1 {width: 330px ;}
# Btn2 {width: 400px ;}
# Btn3 {width: 100px ;}
</Style>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Input type = "button" id = "btn1" value = "1" onclick = "returnstyle ('btn1 ', 'width')"/>
<Input type = "button" id = "btn2" value = "2" onclick = "ff ()"/>
<Input type = "button" id = "btn3" value = "3" onclick = "IE ()"/>
</Div>
<SCRIPT type = "text/JavaScript">
// Both IE and FF can be executed.
Function returnstyle (OBJ, stylename ){
VaR myobj = typeof OBJ = "string "? Document. getelementbyid (OBJ): OBJ;
If (document. All ){
Alert (eval ("myobj. currentstyle." + stylename ));
} Else {
Alert (eval ("document. defaultview. getcomputedstyle (myobj, null)." + stylename ));
}
}
// Only FF is supported
Function ff (){
Alert (document. defaultview. getcomputedstyle (document. getelementbyid ('btn2'), null). width );
}
// Only supports IE
Function IE (){
Alert (document. getelementbyid ('btn3'). currentstyle. width );
}
</SCRIPT>
</Form>
After analysis, the use in IE and FF is different!