tr****@gmail.com wrote:
How can I do the following using html/javascript
Page 1 has a form with a text field, when you click on a link next to
the textfield it launches page2 where you click on a picture which
returns a value back to page 1 without page 1 reloading.
So basically I want to launch a new page2 from page1 and then return a
value back to the form on page 1.
Please provide a simple example code if possible.
Thanks
Hi,
You asked this in comp.lang.php yesterday eh? ;-)
Well, that is not diificult.
One straightforward approach:
1) open the new window using window.open()
2) produce in that page your picture and add something like this:
<img src="img1.jpg" onClick="postBack('img1.jpg');"><br>
<img src="img2.jpg" onClick="postBack('img2.jpg');"><br>
And add in the head:
<script type="text/javascript">
function postBack(imgsrc){
opener.imageClicked(imgsrc);
// and maybe close the popup
self.close();
}
</script>
And add in your first page the function imageClicked:
<script type="text/javascript">
function imageClicked(someImage){
alert("You clicked: "+someImage);
}
</script>
regards,
Erwin Moller