471,594 Members | 2,317 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Problem with open enlarged version of an image in a new window

Hello NG,
i have a picture galerie with thumbnails. I want to add JS functionality
that opens a new window with an enlarged version of the image when the user
clicks on the thumbnails picture.
See the following URL for an example:
http://www.faschingsclub-roettenbach...gramm2003.html

What happens with my showLargeImage function now is that whenever I want to
open the first image (could be any of the 22 pictures on the page), the new
window always shows the upper left image (['image1']). The function does not
execute the change of image sources. What can I do about this?

Generally, am I doing this right or is there a better way of implementing
this showlargeImage functionality?

Thanks a lot,
Markus
Jul 20 '05 #1
1 1726
Lee
Markus Seibold said:

Hello NG,
i have a picture galerie with thumbnails. I want to add JS functionality
that opens a new window with an enlarged version of the image when the user
clicks on the thumbnails picture.
See the following URL for an example:
http://www.faschingsclub-roettenbach...gramm2003.html

What happens with my showLargeImage function now is that whenever I want to
open the first image (could be any of the 22 pictures on the page), the new
window always shows the upper left image (['image1']). The function does not
execute the change of image sources. What can I do about this?

Generally, am I doing this right or is there a better way of implementing
this showlargeImage functionality?


The window.open() function returns immediately, before the new window
is actually opened. You're trying to change the source of the <img>
tag before that tag has been created.

It's probably simplest to send the URL of the image to the new window
in the search portion of the window's URL:

window.open('largeImage.html?myimage.gif',...)

and use Javascript code in largeImage.html to change the img source.

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by VR | last post: by
23 posts views Thread by Markus | last post: by
3 posts views Thread by EnjoyNews | last post: by
5 posts views Thread by althafexcel | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

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.