Forum Moderators: open

Message Too Old, No Replies

How to pass originating window URL to pop-up window

How to pass originating window URL to pop-up window

         

cjglynn

10:22 pm on Apr 30, 2006 (gmt 0)

10+ Year Member



I'm a JavaScript neophyte looking for some help for what seems to be a simple thing: I want to pass the URL of a Web page (say PAGE1) to a pop-up window (say PAGE2) that I will pop-up from PAGE1.

HTML code on PAGE1:
<a href="javascript:openPopUp(location.href)">POPUP WINDOW</a>

JavaScript Code on PAGE1:
<script language="JavaScript" type="text/javascript">
<!--
function openPopUp(value) {
var myValue=value
var myStuff = "PAGE2.htm?" + myValue
if (myValue!="") {
alert(myStuff)
window.open(mySuff, 'NAME HERE', 'width=1000,height=650,scrollbars=yes');
}
else {
alert("Please enter value.")
}
}
//-->
</script>

HTML code on PAGE2:
...
<form name='Contact' action='cgi-bin/FormMail.New.pl' method='post' autocomplete='off'>
<input type=hidden name="recipient" value="name@domain.com">
...
<script language="JavaScript" type="text/javascript">
<!--
var mystuff=getURLPram(mystuff)
document.write('<input type="hidden" name="MyURL" value=location.search.substring(1) />')
//-->
</script>
...
<input type="submit" value="Send Message" name="submit">&nbsp;<input type="reset" />
</form>

Issues:
- I can't seem to get the window.open to work on PAGE1
- Is this the right code to place on PAGE2 to get the data passed in the URL and make it part of a hidden filed in a form?

Help, please...
Thx in advance.

randomboy

10:49 am on May 1, 2006 (gmt 0)

10+ Year Member



Are you basically tyring to create a popup window of page 2 on page 1?

cjglynn

3:37 pm on May 1, 2006 (gmt 0)

10+ Year Member



Random: Thanks for your reply. No I am trying to pass the URL of PAGE1 to PAGE2 as a parameter. PAGE2 will contain a FORM that will be dynamically built depending on the URL that gets passed to it.
Thanks,

randomboy

4:21 pm on May 1, 2006 (gmt 0)

10+ Year Member



Oh right, I can't help you there then. Sorry.