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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing parameters from opener to popup and vice versa

Status
Not open for further replies.

jermine

Programmer
Jun 15, 2001
59
SG
guys i hope you can help. im stuck with this problem.

i have a page / form "edit.jsp" where user may change data upon clicking the submit button.

the page,"validate.jsp" is called.
here, i have placed an <body onload=&quot;validate()&quot;;>

function validate()
{
msgWindow=window.open('','displayWindow','top=150,left=150,width=325,height=300');
document.formName.method = &quot;POST&quot;;
document.formName.target = &quot;displayWindow&quot;;
document.formName.action = &quot;edit-confirm.jsp&quot;;
document.formName.submit();

document.formName.method = &quot;POST&quot;;
document.formName.action = &quot;list.jsp&quot;;
document.formName.target = &quot;_self&quot;;
document.formName.submit();
return;
}

with this code, the current window is directed to &quot;list.jsp&quot; that reflects the changes made, and a pop-up is also displayed, the &quot;edit-confirm.jsp&quot; where use must click button to call another page &quot;welcome.jsp&quot; that should be displayed on the window where the &quot;list.jsp&quot; is currently shown and the popup closes.

what makes this more difficult for me is i have to keep the old parameters from the previous pages.
:-/




 
This worked in IE 5 but not in Mozilla, you should probebly set a var in the test1.htm window in the passValueAgain function and use the body onload of the test1.htm to pass the value of that var to the textbox.
Here is the code:
test.htm:
<input type=text value='move this value' id=txtpassval><br>
<input type=button value='open win' onclick=&quot;window.open('pop.htm',null);&quot;>

pop.htm:
<script>
function passValue() {
document.getElementById('popupvalue').value = window.opener.document.getElementById('txtpassval').value;
}
function passValueAgain() {
var objWindow = window.opener;
objWindow.document.location = &quot;test1.htm&quot;
objWindow.document.getElementById('txtpassval').value = document.getElementById('popupvalue').value;
window.close();
}
</script>
<body onload=&quot;passValue();&quot;>
<input type=text id='popupvalue'><br>
<input type=button value='move value again' onclick='passValueAgain();'>

test1.htm:
<input type=text id=txtpassval><br>
<input type=button value='open win' onclick=&quot;window.open('pop.htm',null);&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top