0

Basically, how it should work is:

-The user chooses an option on the first page
-The next page is displayed with one image changed around according to what they picked

I can't think of a way to do this, without creating a different page for each image. There will eventually be hundreds of choices and I'm hoping there is some sort of JavaScript solution to this so I don't have to create that many pages. I don't know JavaScript that well, though.

Any help is appreciated.

John Smith
  • 3
  • 1
  • 2
  • 2
    Generally JavaScript is the wrong tool for this, what do you use on the server? Just static HTML pages or PHP or something like that? If you really want to go for it in JavaScript I recommend passing the selection as url parameter and then using what is suggested here: http://stackoverflow.com/questions/1403888/get-url-parameter-with-javascript-or-jquery – ced-b Sep 08 '13 at 03:19
  • 1
    What about using a cookie to record the choice on the first page, and then a script on the second page to act on that? – Robert Byrne Sep 08 '13 at 03:20

3 Answers3

0

Window handling should help you. Here is the MDN Documentation

0

How about passing the image choice as a query string and setting up the image on page load with either your back-end or client-side JS?

probablyup
  • 7,636
  • 1
  • 27
  • 40
0

The way of how I would do it (if I wasn't limited to just javascript) would be to use php. First I would have all the pages content in a file (header, footer, etc...) and just use a require_once or include_once function by including the file name in a new php file and add code for a new image.

I am pretty sure that javascript has similar functions such as require_once or include_once. With it, you can just have all the pages content in one place and when the user clicks on a new image, you can create a new file without recopying all the code from the previous page and simply add the image.

ruthless
  • 1,090
  • 4
  • 16
  • 36