If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Updating an image in new window while retaining focus

Hello all,

I work on a site that has a number of image galleries set up as clickable thumbnails. On a click, some js is called that opens a new window, sizes it and displays a large image there.

Originally, I had an .html page for every image but that quickly grew cumbersome. My second try was to write the image directly to the page with a call to document.write(). This version opened the image but when the user clicked another thumbnail, the image didn't change and the new window lost focus.

My third and current version is a kludgy monstrousity that opens a new window, then closes it, then opens it again and displays the image. It's the only way I could figure out to both change the image and retain the focus. This version works for most of the site's users but not all.

Is there a better way to do this? To be clear, the behavior should be as follows:

1. user clicks first thumbnail
2. image window opens over the main window, and displays the enlarged image
3. without closing the image window, the user clicks another thumbnail on the main window.
4. image window is updated to display new enlarged image and gets the focus (comes to the front)