HBCMS更多的中文手册参考:

WIDTH Attribute | width参数属性

DHTML文档教程

Sets or retrieves the calculated width of the object.

dhtml语法

HTML<ELEMENT WIDTH = iWidth... >
Scriptingobject.width [ = iWidth ]

DHTML可能的值

iWidthInteger that specifies or receives one of the following values.
widthInteger that specifies the width of the object in pixels or as a percentage.
percentageString that specifies an integer value followed by a %. The value is a percentage of the width of the parent object.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.

remarks

if you specify the width property of an img, but not the height property, the resulting height of the img is sized proportionally to the specified width property and the actual height, in pixels, of the source image file. consider the following example:

dimensions of image in source file (pixels):100 x 50 (w x h)
specified image width:2in
specified image height:not specified
resulting image width:2in
resulting image height:1in ((50/100) * 2 inches)

if you specify the width property of an img, and the height and width of the image in the source file are identical, the height of the image matches the width.

if you specify the height property and the width property of an img, the resulting image dimensions match the height and width specified.

when scripting the height property, use either the pixelheight or posheight property to numerically manipulate the height value.

if dynamic changes are intended for the height and width, the original values should be set through style (e.g. "style=''height:200px; width:200px'') rather than through the height and width attributes.

although you can specify the width as a percentage, this property always retrieves the width in pixels.

DHTML代码范例

This example sets the width of the image to 20 pixels regardless of the original size of the image.

<IMG SRC="large.gif" WIDTH="20">

是否符合公共标准

This property is defined in HTML 4.0 Non-Microsoft link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text