Forum Moderators: open

Message Too Old, No Replies

javascript variable stored and appended to url string

         

dartanian

1:45 am on Apr 5, 2005 (gmt 0)



I am using Dreamweaver MM_swapImage and MM_swapImageRestore to swap images in an ASP page. Currently in my page ASP loads a determined number of thumbnail images in an include file, and each swaps a main image on the page onclick. My images have name and id attributes, and I am using a window.open javascript to open a new window with a large version of the main image on the page. For instance, when the third thumbnail is clicked, the main image (id=mainPic) on the page is swapped to "mainImage3.jpg". I want to pass "imgNum=3" in the querystring to the popup javascript so the new window can show the correct large image.

I think what needs to happen to achieve my desired results is:
1. I'd like to store a variable (from 1 to 10) on the onclick event of the thumbnails (in addition to the MM_swapImage function)
2. On the main image onclick event that invokes the new window script I'd like to get the stored variable and append it to the url string value in the popup script.

Any ideas? Thanks in advance

SpaceFrog

7:32 am on Apr 5, 2005 (gmt 0)

10+ Year Member



all you actually need to do is a little script to concatenate your url:

var myurl="mypage.htm"
then add what ever parameter you need

myurl+= "?" +param1
myurl+= "&" +param2
etc ...

then trigger new page

window.location.href=myurl