Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit form variables to a new pop-up window

Status
Not open for further replies.

anik21

Programmer
Feb 2, 2004
4
0
0
US
How do I submit a form variable from a parent window to a pop-up window. I am not using any buttons on the parent window. I have a hyperlink using <a href...
My code looks like this:


<a href='Rep.asp' onclick= javascript: Go('3');window.open('Rep.asp'); document.frm.submit; return false;target=_blank>GO </a>


<script language = javascript>
function Go(number)
{
window.open('newwind.asp')}
</script>

The variable is not being passed. I would like to have the number variable in the javascript function to be passed to the new window. I do not want to use querystring.Please help!

thanks..
 
This may be an HTML problem. What is the form action? The URL in the form action is where the form data is going. It doesn't matter how many windows you open or what you put in them.
 
Try this ...

Put a hidden field in your parent form named myhiddenfield (or whatever)

In the GO function, add:

// Set the hidden field value to whatever...
document.myform.myhiddenfield.value = 3; // or whatever

In the POP UP code, use:

// get the form var from parent window
var myVar = document.opener.myform.myhiddenfield.value

for X-browser comp use

window.document...etc

Regards,
Trope
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top