Availability: |
| |||||
Inherits from: | Element object& | |||||
JavaScript syntax: | IE | myImage = myDocument.all.anElementID | ||||
IE | myImage = myDocument.all.tags("IMG")[anIndex] | |||||
IE | myImage = myDocument.all[aName] | |||||
- | myImage = myDocument.anImageName | |||||
- | myImage = myDocument.getElementById(anElementID) | |||||
- | myImage = myDocument.getElementsByName(aName)[anIndex] | |||||
- | myImage = myDocument.images[anIndex] | |||||
- | myImage = myImageArray[anIndex] | |||||
- | myImage = myDocument.getElementsByTagName("IMG")[anIndex] | |||||
HTML syntax: | <IMG> | |||||
Argument list: | anIndex | A reference to an element in a collection | ||||
aName | An associative array reference | |||||
anElementID | The ID value of an Element object | |||||
Object properties: | border, complete, constructor, defaultValue, height, hspace, lowsrc, name, size, src, vspace, width, x, y | |||||
Object methods: | select() | |||||
Event handlers: | onAbort, onBlur, onClick, onDblClick, onError, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp |
The Image object added at version 1.1 of JavaScript introduced the possibility of dynamically replacing images under script control.
Event handling support via properties containing function objects was added to Image objects at version 1.1 of JavaScript.
The Image object supported by Netscape and the IMG object supported by MSIE are so different to each other that they are covered as separate objects. They share a few similarities but not many. By inspection, they are instances of different classes.
In the MSIE browser, the images are instantiated inside IMG objects because they correspond to the IMG tag. There is an Image object created as another name for the same IMG tag and if you instantiate a new copy of it you get an IMG object. This means you should be careful when examining the constructors and class names of image objects, as their object type is not portable across platforms.
<HTML> <HEAD> <SCRIPT> function moved() { document.all.ONE.width = event.x; } </SCRIPT> </HEAD> <BODY onMouseMove="moved()"> Move mouse horizontally to scale image<BR> <IMG HEIGHT=40 ID="ONE" SRC="assets/image_9.gif"> </BODY> </HTML>
Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
border | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
complete | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
constructor | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
defaultValue | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ![]() |
height | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ReadOnly. |
hspace | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ReadOnly. |
lowsrc | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
name | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
size | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ![]() |
src | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
vspace | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ReadOnly. |
width | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ReadOnly. |
x | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ReadOnly. |
y | 1.1 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ReadOnly. |
Event name | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
onAbort | 1.1 ![]() | 1.0 ![]() | 3.0 ![]() | 3.02 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onBlur | 1.1 ![]() | 3.0 ![]() | 3.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onClick | 1.1![]() | 1.0 ![]() | 2.0 ![]() | 3.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onDblClick | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onError | 1.1 ![]() | 3.0 ![]() | 3.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onFocus | 1.1![]() | 3.0 ![]() | 2.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onHelp | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onKeyDown | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onKeyPress | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onKeyUp | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onLoad | 1.1![]() | 1.0 ![]() | 2.0 ![]() | 3.02 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onMouseDown | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseMove | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseOut | 1.1 ![]() | 3.0 ![]() | 3.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseOver | 1.1![]() | 1.0 ![]() | 2.0 ![]() | 3.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseUp | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
Prev | Home | Next |
Image animation | Up | Image() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |