I often use the constructor Image() - i.e., for image preloading. But I cannot find any official specification for it. Does it take parameters Can it take image URL as a parameter I didn't find its description on MSDN neither in "DHTML", nor in "JScript 5.6". Where to look for a spec

Re: Internet Explorer Web Development JScript: spec for "new Image"?


According to the specs, when Netscape defined them, the Image constructor takes 2 optional parameters, width & height.

var foo = new Image();


var foo = new Image(400, 300);

if you want to set the url, just set the src attribute...

foo.src = 'http://www.yourDomain.com/images/foo.png';

For the record, you can use the DOM now to do this as well...

var foo = document.createElement('img');
foo.setAttribute('src', 'http://www.yourDomain.com/images/foo.png');

PS Dev Guru is a great site for JavaScript information. It will even identify which methods are unsupported by Internet Explorer, and those that IE added that are not part of the spec.


Re: Internet Explorer Web Development JScript: spec for "new Image"?


I know about Netscape specs, but my interest was where to find it at MSDN. It seems strange that something is implemented in IE, but not described in IE's technical specifications.