DHTML Object Properties DHTML Objects
Sets or retrieves the width of the object, in pixels.
HTML |
N/A |
Script |
object.style.pixelWidth [ = iWidth ] |
iWidth |
Integer value specifying the width, in pixels. |
The property is read/write with no default value.
Setting this property changes the value of the width without changing the units designator. Unlike the width property, this property's value is an integer, not a string, and is always interpreted in pixels.
For more information on how to access the dimension and location of objects on the page through the document object model, see Measuring Element Dimension and Location.
In the following sample, the pixelWidth is incremented through use of a timer.
<script language="JavaScript">
function scaleThis ( ) {
if ( sphere.style.pixelWidth <900 ) {
sphere.style.pixelWidth += 4;
sphere.style.pixelHeight += 4;
window.setTimeout ( "scaleThis ( );", 1 );
}
}
</script>
This feature requires Microsoft® Internet Explorer® 4.0 or later.
Show me
posWidth