Connecting Tech Pros Worldwide Forums | Help | Site Map

Passing a variable to a new window

Adrian MacNair
Guest
 
Posts: n/a
#1: Jul 23 '05
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=76 0,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?





Adrian MacNair
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Passing a variable to a new window


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">');


Closed Thread