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"> <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.
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"> <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.