Name
Image: an image in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement → Image
Constructor
new Image(integerwidth, integerheight)
Arguments
width,heightAn optionally specified width and height for the image.
Properties
-
String name This property specifies the name for the image object. If an
<img>tag has anameattribute, you can access the corresponding Image object as a named property of the Document object.-
String src A read/write string that specifies the URL of the image to be displayed by the browser. The initial value of this property is specified by the
srcattribute of the<img>tag. When you set this property to the URL of a new image, the browser loads and displays that new image. This is useful for updating the graphical appearance of your web pages in response to user actions and can also be used to perform simple animation.
In addition to these properties, Image objects also support the following properties, which simply mirror HTML attributes:
|
Property |
Attribute |
Description |
|
|
|
Alignment with respect to inline content |
|
|
|
Alternate text when image can’t be displayed |
|
|
|
Size of image border |
|
|
|
Image height, in pixels |
|
|
|
Left and right margins, in pixels |
|
|
|
Whether to use a server-side image map |
|
|
|
The URI of a long image description |
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access