Language References
HTML 2, 3.2, 4, 4.01, 5
Represents the cascaded format and style of the object that overrides the specified format and style by global style sheets, inline styles, and HTML attributes.
The runtimeStyle object sets and retrieves the format and style of an object, and overrides existing formats and styles in the process. Other than having precedence over the style object and not persisting, the runtimeStyle object is equivalent to the style object.
runtimeStyle Members
The following example shows setting a value on the runtimeStyle object affects the currentStyle object, but not the style object.
<script language="JavaScript">
function fnChangeValue ( sValue ) {
if ( oDIV.runtimeStyle.backgroundColor ==
oDIV.style.backgroundColor ) {
sValue="";}
oDIV.runtimeStyle.backgroundColor = sValue;
alert ( oDIV.style.backgroundColor +
"\n" + oDIV.currentStyle.backgroundColor +
"\n" + oDIV.runtimeStyle.backgroundColor );
}
</script>
<div ID = "oDIV">
This is a demonstration DIV.
</DIV>
<INPUT TYPE = "button" VALUE = "Change Color"
onclick="fnChangeValue ( 'blue' )">
The following example demonstrates the use of the runtimeStyle object to override the value of the style object, plus reflect how the currentStyle object is updated.
This feature requires Microsoft® Internet Explorer® 5 or later.
Show me
currentStyle, style