[Javascript] passing variables - basic question

Cheng, Kynan (London) ChengKyn at exchange.uk.ml.com
Wed Apr 11 04:00:09 CDT 2001


Hi guys,

I have not coded in Javascript before and I am trying to find out how to
pass variables from page to page, so I was wondering if someone could look
this over briefly:



For example, if I have a page with thumbnail, and I'd like to call a page
that dynamically places the original photo into it (based on the thumbnail
clicked) does it go a little something like this?


 in index.html:
<a href="picture.html?selectedpicture=pictureone.jpg"><img
src="thumbnailone.gif"></a>
 
 in picture.html
(PHP version) <a href="index.html"><img src="<?php print $selected picture
?>"></a>
(JS version) which doesn't work
<script>
document.write("<a href='index.html'><img src=", selectedpicture , "></a>")
</script>


Do i need to have some script which takes in the URL argument?
Is there another (better) way to pass variables?

Thanks
Kynan






More information about the Javascript mailing list