img onClick problem

J

Jason Chan

I create a webpage contain a table of thumbnails (around 30).
Since the thumbnails is generated on the fly, it take some time to load all
of them, around 15s.

On each image, I have a onClick listener to open the larger version of
thumbnail in a popup window.

If I click one of image when the page is still downloading the remaining,
the popup open but the opener window stop download the remaining. Is it a
normal behavior or I can do something to walk around it?

Some of my code.
<a href="javascript:eek:penImage(1);">
<img alt="" src="getResizedImageByID.aspx?id=1" />
</a>


function openImage(FileID)
{
var winl = (screen.width - 610) / 2;
var wint = (screen.height - 610) / 2;
winprops = 'height=' + 610 + ',width=' + 610 +
',top='+wint+',left='+winl+',scrollbars=no'
win = window.open("","Preview", winprops)
win.document.bgColor="#666666";
docBody = win.document.body;
docBody.style.margin = "5px 5px 5px 5px";
docBody.innerHTML = "<img src='getResizedImageById.aspx?id=" +
FileID + "&w=600' />";
win.focus();
}

P.S Brower IE 6
 
M

Mr Newbie

why dont you direct the onlick event to a function and have that function
exit unless all the images are loaded ?
 
M

Mr Newbie

easy, just use the onLoad event for the IMG

<IMG onLoad="javascript:yourFunction();"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top