[thelist] Site Evaluation - Crush Kill Destroy + URL
Niklaus Haldimann
n.haldimann at derbund.ch
Wed Jul 5 03:53:15 CDT 2000
My code was:
>: function ImgGlobal() {
>: if(document.images) {
>: globals = new Array();
>: for (i=1;i<=20;i++) globals[i]=new Image();
>: globals[1].src = "logo.gif";
>: globals[2].src = "spacer.gif";
>: file://etc
>: globals[20].src = "dot.gif";
>: }
>: }
Jeff wrote:
>i find the above to be very hard to work with when setting up the rollovers
>because you have to remember what index of the globals array holds the
>preloaded image. instead, it's easier to preload the images so they're
>object name is a derivative of the name of the image space they're being
>swapped into.
Yeah. You're right. But I hate to have a bazillion JavaScript lines just to
perform a simple preload, that's why I prefer my solution. And then I
always use this universal rollover function that isn't bound to the
standard on/off way of using rollovers:
// Swap Image Function
function si (img,imgsrc) {if (document.images) {img.src=imgsrc}}
I love it for it's simplicity. Of course I gotta name image tags to perform
a rollover, but I don't need to remember the array number. Like so:
<a href="blabla.html" onMouseOver="si(document.blabla,'blabla2.gif')"
<img src="blabla.gif" name="blabla">
</a>
Cheers,
Niklaus.
--
niklaus haldimann - web wiz @ der bund verlag ag
at work: http://www.ebund.ch
at play: http://ubique.virtualave.net new*orange!
More information about the thelist
mailing list