"altreed" <ca*************@hotmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Thanks for the advice, I understand the approach.
I tried the code below, not really understanding it (never looked at
java). I find that it doesn't work.
I am being very cheeky, but could you break it down. I am getting
placeholders with an x in it.
Spacer.gif is a common name for a gif containing a single transparent pixel.
You should be able to download one from somewhere if you haven't got one
already.
There is a bug in the code I posted the top of the imgDone function should
look like this:-
var img = this.nextSibling
if (img.nodeType == 3) img = img.nextSibling // this line was missing
var src = img ? img.getAttribute("altsrc") : null
>
Thanks
Dave
Anthony Jones wrote:
Do it clientside in Javascript (warning air code):-
<script type="text/javascript">
// When image has finished loading it calls this function
function imgDone()
{
// Retrieve an the next image node in the document after the one that just
loaded
var img = this.nextSibling
// skip any interveaning #text node
if (img.nodeType == 3) img = img.nextSibling // this line was missing
// The true src url for the image was stored as an extra attribute on the
img tag.
// If the calling img is the last one then the img variable will now be
null
var src = img ? img.getAttribute("altsrc") : null
if (src)
{
//make this function the target of the img onload event
img.onload = imgDone
// setting the src property will cause the next image to download
img.src = img.altsrc
// when the img has finished this function is called again until all
images are loaded
}
}
</script>
<!-- The first img has it's src set correctly and onload event to call the
imgDone function -->
<img src="/folder/image1.jpg" onload="imgDone.call(this)" />
<!-- all subsequent imgs will specify spacer.gif as the original src and the
real url on a altrc attribute -->
<img altsrc="/folder/image2.jpg" src="spacer.gif" />
..
..
..
<img altsrc="/folder/imageN.jpg" src="spacer.gif" />
Now the load of each img invokes the loading of the next until they are
all
done. Hence only one image will be downloading at a time.