I'm developing a web app at the moment, and, being a perfectionist, I try to make it all shiny and compliant with all the standards. As far as I know, the <img>
tag is to be deprecated in the upcoming standards for xHTML, and as nowadays even IE is able to handle <object>
properly, I wanted to use the <object>
tag for all the images on my site.
Now, I need to preload some of my images for standard onmouseover
swapping. It was no problem with <img>
:
var rateImagesURLs = new Array("images/mark0.png", "images/mark1.png");
var rateImages = new Array(rateImagesURLs.length);
for (var i=0;i<rateImagesURLs.length;++i) {
rateImages[i] = new Image();
rateImages[i].src = rateImagesURLs[i];
}
but I can't get it to work with <object>
. I just can't find a way to connect JavaScript's Image
object to actual <object>
tag. I tried playing with <object>
's data
, as well as archive
attribute, but even the guys at W3C seem to be unsure as to how to use it, suggesting in their documents separating values with spaces in one place, and then commas a few paragraphs below... So my question is: how do I preload images in JavaScript using <object>
tag?
P.S. Sorry for lengthy intro for rather simple question.