Randy Webb wrote:
michaaal wrote: Is this the correct way to preload an image...?
Var Image1 = new Image()
var is case sensitive, its lower-case v
And you have forgotten to define the src attribute to the new Image()
you just created.
Image.src='url to Image';
Image1.src = ...
^
Otherwise a property would be added to the constructor.
....And then when I'm ready to use the image I can do this...?
Button1.src=Image1.src
....Or am I just telling Button1 to use the same source path as Image1?
With the above additions, now you can.
Yes, indeed :)
Yet it is not a very good way of preloading images, if there is some
(preloading should be done very careful -- not only that is is not really
required, it is unreliable [because my cache is *my* cache and client-side
scripting may be disabled/restricted/not present] and if it works it forces
users to download data they do not requested), it is unreliable,
error-prone and quite hard to maintain. I have been working on another
approach that does not show most of these problems:
<http://pointedears.de/scripts/test/hoverMe>
PointedEars