Passing a variable to a new window

A

Adrian MacNair

Let's say I have thumbnail 1 and thumbnail 2.

If I click on thumbnail 2 I want it to load a webpage which shows the larger
image of image 2. If I click on thumbnail 1 I want to load the same webpage
but swap the image to image 1. Any ideas?

The problem:

<a href="#"
onClick="window.open('bigger.html',null,'height=760,width=700,status=yes,too
lbar=no,menubar=no,location=no')">
<img src="images/thumb2.jpg" width="72" height="96" alt=""
border="0"></img></a>

The default image in bigger.html is image 1. Onload I would like it to be
image 2 if the thumbnail is clicked. Does this make sense?
 
A

Adrian MacNair

I *think* I figured it out:

In main window:

<a href="#"
onClick="window.open('bigger.html?2',null,'height=760,width=700,status=yes,t
oolbar=no,menubar=no,location=no')">
<img src="images/thumb2.jpg" width="72" height="96" alt=""
border="0"></img></a>

In popup window:

largeImage=String(location.search);
largeImage=largeImage.substring(1);

document.write('<img id="gallimg" src="images/large'+largeImage+'.jpg"
border="0">');
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top