473,782 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

img onClick problem

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="javascrip t:openImage(1); ">
<img alt="" src="getResized ImageByID.aspx? id=1" />
</a>
function openImage(FileI D)
{
var winl = (screen.width - 610) / 2;
var wint = (screen.height - 610) / 2;
winprops = 'height=' + 610 + ',width=' + 610 +
',top='+wint+', left='+winl+',s crollbars=no'
win = window.open("", "Preview", winprops)
win.document.bg Color="#666666" ;
docBody = win.document.bo dy;
docBody.style.m argin = "5px 5px 5px 5px";
docBody.innerHT ML = "<img src='getResized ImageById.aspx? id=" +
FileID + "&w=600' />";
win.focus();
}

P.S Brower IE 6
Nov 20 '05 #1
3 2987
why dont you direct the onlick event to a function and have that function
exit unless all the images are loaded ?


--
Best Regards

The Inimitable Mr Newbie º¿º
"Jason Chan" <no@email.com > wrote in message
news:u$******** ******@tk2msftn gp13.phx.gbl...
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="javascrip t:openImage(1); ">
<img alt="" src="getResized ImageByID.aspx? id=1" />
</a>
function openImage(FileI D)
{
var winl = (screen.width - 610) / 2;
var wint = (screen.height - 610) / 2;
winprops = 'height=' + 610 + ',width=' + 610 +
',top='+wint+', left='+winl+',s crollbars=no'
win = window.open("", "Preview", winprops)
win.document.bg Color="#666666" ;
docBody = win.document.bo dy;
docBody.style.m argin = "5px 5px 5px 5px";
docBody.innerHT ML = "<img src='getResized ImageById.aspx? id=" +
FileID + "&w=600' />";
win.focus();
}

P.S Brower IE 6

Nov 20 '05 #2
OK, but how do I know all images are loaded, from the script

"Mr Newbie" <he**@now.com > ¼¶¼g©ó¶l¥ó·s»D: uK************* *@TK2MSFTNGP11. phx.gbl...
why dont you direct the onlick event to a function and have that function
exit unless all the images are loaded ?


--
Best Regards

The Inimitable Mr Newbie º¿?
"Jason Chan" <no@email.com > wrote in message
news:u$******** ******@tk2msftn gp13.phx.gbl...
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="javascrip t:openImage(1); ">
<img alt="" src="getResized ImageByID.aspx? id=1" />
</a>
function openImage(FileI D)
{
var winl = (screen.width - 610) / 2;
var wint = (screen.height - 610) / 2;
winprops = 'height=' + 610 + ',width=' + 610 +
',top='+wint+', left='+winl+',s crollbars=no'
win = window.open("", "Preview", winprops)
win.document.bg Color="#666666" ;
docBody = win.document.bo dy;
docBody.style.m argin = "5px 5px 5px 5px";
docBody.innerHT ML = "<img src='getResized ImageById.aspx? id=" +
FileID + "&w=600' />";
win.focus();
}

P.S Brower IE 6


Nov 20 '05 #3
easy, just use the onLoad event for the IMG

<IMG onLoad="javascr ipt:yourFunctio n();"

--
Best Regards

The Inimitable Mr Newbie º¿º
"Jason Chan" <no@email.com > wrote in message
news:u$******** ******@TK2MSFTN GP14.phx.gbl...
OK, but how do I know all images are loaded, from the script

"Mr Newbie" <he**@now.com >
¼¶¼g©ó¶l¥ó·s»D: uK************* *@TK2MSFTNGP11. phx.gbl...
why dont you direct the onlick event to a function and have that function
exit unless all the images are loaded ?


--
Best Regards

The Inimitable Mr Newbie º¿?
"Jason Chan" <no@email.com > wrote in message
news:u$******** ******@tk2msftn gp13.phx.gbl...
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="javascrip t:openImage(1); ">
<img alt="" src="getResized ImageByID.aspx? id=1" />
</a>
function openImage(FileI D)
{
var winl = (screen.width - 610) / 2;
var wint = (screen.height - 610) / 2;
winprops = 'height=' + 610 + ',width=' + 610 +
',top='+wint+', left='+winl+',s crollbars=no'
win = window.open("", "Preview", winprops)
win.document.bg Color="#666666" ;
docBody = win.document.bo dy;
docBody.style.m argin = "5px 5px 5px 5px";
docBody.innerHT ML = "<img src='getResized ImageById.aspx? id=" +
FileID + "&w=600' />";
win.focus();
}

P.S Brower IE 6


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3689
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function and passes it two parameters. For the life of me I cannot figure out what the error is, but one occurs everytime I click a &%*$&# radio button. Also, the function only alerts the user immediately as to what question/answer they clicked. I am...
5
10886
by: Mike | last post by:
In my previous post, I wrote: > ... > GOAL: (very simple) Provide a hyperlink which, when clicked, > calls a javascript function which opens a new URL. > ... > PROBLEM: The following code works fine if I click to open in > the same window, but if I click the browser option to open in a > new window, the new window tries to open the href URL (the > onClick function does get executed, but seems to be ignored). > ...
17
61445
by: Mike Gratee | last post by:
Is it possible to use JavaScript to cause the browser to click a link on a page and have the browser act exactly like the user had clicked on the link directly? In other words, I need to programmatically issue a JavaScript statement which causes the browser to act just like the user clicked on a link in my page. And if that link has an onClick JS event defined, I'd want that onClick event to execute too, exactly the same as if the user...
8
67463
by: KS | last post by:
Just to show some code to show the consept. <img id="date" onclick="javascript:show_calendar();" src="/PlexSysWeb/images/show-calendar.gif" width=20 height=18 border=0> What i want the javascript to do is change the onclick value of the <IMG> tag above, by calling the test function from the same webpage by onclick on a button.
5
2587
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below is the code for this. the onclick event calls a javascript function which I put an alert in the firt line to tell me if its working. It does work in IE. Any ideas on how to get netcrap... oops, I'm sorry, netscape to fire the onclick event? ...
11
3033
by: GaryB | last post by:
Hi Guys, I've been battling with this one for hours - I hope that you can help me! My code modifies the <aon a page, from a standard document link into a link with a tailored onclick event. It works perfectly (assigning the correct images and the correct onclick events to the correct <atags):
7
7481
by: abs | last post by:
Hi everyone. Please, check my test code here: http://skocz.pl/jstest . The trouble is that no matter which span element I click, it alerts '3' and I'm wondering why not '1' for the first span, '2' for second and '3' for third ? Anybody has any idea ? Best regards, ABS
3
6509
by: Michael_R_Banks | last post by:
I'm trying to dynamically build a table that allows users to remove rows when they click a corresponding button. For some reason, whenever I add the button to the table, it never fires the onclick event. I'm stumped with this one, any assistance would be appreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"...
2
1960
by: stevemtno | last post by:
I've got a problem with a web page I'm working on. I have 4 modules - one of them has 2 tabs, two of them have 4 tabs. When the user clicks on the tabs, the content below them changes. However, when the user clicks on the tab (any tab), the browser goes back to the top of the page (I'm assuming it's refreshing, I'm not sure). I'm attaching the JS code below, along with the 2-tab version of the module and its accompanying CSS. Any help will be...
2
2743
by: DavidGeorge | last post by:
In an earlier thread I recounted a problem I was having, but it took a while to reduce the problem to it's basic components and the issue became somewhat confused in reaching that point. I hope you will excuse me for bringing it up again but this issue is very frustrating. I created a new form in a brand new (Access 2003) database. This example does nothing useful other than to illustrate the problem. I've explained what I want to do in...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.