Yep,
That's one way to do it (I wasn't sure if the browser would render the
image
tag as a cross box or not, when the src attribute wasn't specified).
Try: <img src=3D"about:blank" or maybe <img src=3D"javascript:void"
(I have no idea if this works! :-))
If not, Abdul's suggestion is a good and easy option!
/Robert
-----Ursprungligt meddelande-----
Fr=E5n: Abdul Majid Qazi [mailto:majid@i...]
Skickat: den 19 december 2002 00:01
Till: JavaScript HowTo
=C4mne: [javascript_howto] Re: SV: opposite of pre-loading
In Roberts code use a 1 * 1 pixel transparent image as a place holder.
This image will be replaced by your image when you will click the link.
eg.
<img id=3D"imageOne" src=3D"one_pixel_image.gif">
<img id=3D"imageTwo" src=3D"one_pixel_image.gif">
Majid
----- Original Message -----
From: "suhailkaleem" <suhailkaleem@p...>
To: "JavaScript HowTo" <javascript_howto@p...>
Sent: Wednesday, December 18, 2002 3:45 PM
Subject: [javascript_howto] Re: SV: opposite of pre-loading
> hi !
>
> The code you wrote is fine but it shows cross box when the poage is
> loaded ! i wnat to make the image invisble no cross box when
users
> clik on the link then the image loads
> just like in hot mail when you compose email message when you click
> on smily link all the smilies image laod at that time in the layer ?
> how do i do
> that ? i think it will be done by loading then in JavaScript
Objects
like
> new image() like you said ? but you tell which will be better Thanks
> suhailkaleem
>
>
> ----- Original Message -----
> From: "Robert Nyman" <robert.nyman@c...>
> To: "JavaScript HowTo" <javascript_howto@p...>
> Sent: Wednesday, December 18, 2002 4:21 PM
> Subject: [javascript_howto] SV: opposite of pre-loading
>
>
> Do you want to load the images into the page so that they become
> visible,
> or do you want to load them into JavaScript Objects (as in new
Image())?
>
> If you want to display them in the page when the user clicks a link,
> you can do it something like this (which will be pretty complex if
> you have a lot of images):
>
>
> At load time:
>
> <img id=3D"imageOne">
> <img id=3D"imageTwo"> etc
>
> and then when you click the link:
>
> function loadImages(){
> document.getElementById("imageOne").setAttribute("src",
> "theImageSrc.gif");
> document.getElementById("imageTwo").setAttribute("src",
> "theImageSrcTwo.gif");
> // Etc...
> }
>
>
> <a href=3D"#" onClick=3D"loadImages(); return false">Load images</a>
>
>
> /Robert
>
>
>
> -----Ursprungligt meddelande-----
> Fr=E5n: suhailkaleem [mailto:suhailkaleem@p...]
> Skickat: den 17 december 2002 22:03
> Till: JavaScript HowTo
> =C4mne: [javascript_howto] opposite of pre-loading
>
>
> hi !
>
> i want to load images when users clicks on a link
> this will help me to decrease downlaod time !
> it is opposite to pre-loading images
> Thanks
> suhailkaleem
>
>
>
>
>
>
>
>
>
>