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

M

Markus Seibold

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.de/html/fotos/ferienprogramm2003.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
 
L

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.de/html/fotos/ferienprogramm2003.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.
 

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,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top