Image object
[This documentation is preliminary and is subject to change.]
Creates and initializes a new img element.
Standards information
There are no standards that apply here.
Remarks
Use this object to instantiate new img elements before adding them to the document. You can specify up to two optional arguments:
| nWidth | Optional. Integer that specifies the img width. |
| nHeight | Optional. Integer that specifies the img height. |
String values are coerced into their numeric equivalents, if possible.
Examples
The following script creates a new image and appends it to the body object..
<script type="text/javascript"> var img = new Image(50, 50); img.src = "image.png"; document.body.appendChild( img ); </script>
See also
Build date: 3/8/2012
Mistake in text
The text describing the optional arguments for this constructor makes reference to both "option text" and "option value," and were obviously copied from the docs on the Option object. These should be "image width" and "image height" respectfully.
- 11/19/2010
- CoatimundiG
- 11/20/2010
- Thomas Lee