On Jan 24, 8:20 pm, "Adam Sandler" <cor...@excite.comwrote:
Quote:
<img id="mapImage" src="Images/null.gif" onload="getImage();" />
>
And in here's the getImage method:
>
function getImage()
{
var objHiddenImage =
document.getElementById("mapImageSrc_hidden");
var objMapImage = document.getElementById("mapImage");
>
objMapImage.src = objHiddenImage.value;
}
>
The problem is on the last line of the getImage method... when I put
the hidden field's value in the src property of the html image, the
page gets stuck in an infinte loop.
Of course it does. This is from the "Top 10 of dummy errors in
JavaScript" :-)
Image loads and calls onload handler. Onload handler instructs to load
another image instead of the current one. New image loads and calls
onload handler. See the top... and so on...
With all <layers>, <iframesand <imgput in onload loop this way
since 1997 one could make a mountain with its paramount in the
stratosphere, so don't be ashamed - you are not the first and most
definitely not the last. :-)
out:
Quote:
objMapImage.src = objHiddenImage.value;
in:
if (objMapImage.src != objHiddenImage.value) {
objMapImage.src != objHiddenImage.value;
}
P.S. More sophisticated ways with removing event listener on first call
are also possible.
Whatever you are doing with image load sequence seems very strange -
but OK, it is your doing.