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

Problem passing values from popup to parent

Status
Not open for further replies.

questhaven

Programmer
Mar 28, 2001
81
US
Hi there - I am working with a page that uses frames - the right frame - called "main" contains a link for a pop-up address book. The window that pops up contains links for different email addresses that can be selected. When the link is clicked it triggers a javascript function that updates that field in the right frame of the parent window. The code that I have works in IE but not in Netscape. Does anyone see any issues with the code?

Thanks again!

THE CODE IN THE RIGHT FRAME:
<form name=&quot;f1&quot; action=&quot;record_share.asp&quot; method=&quot;post&quot;>
<p>Share with: <BR>
<img src=&quot;images/ContactIcon.gif&quot; title=&quot;Click here to use your personal address book&quot; onclick=&quot;openAddressBook('open');return false;&quot; style=&quot;cursor:hand;&quot;></img>
<input name=&quot;txtUserName&quot; value=&quot;&quot; width=155&quot; maxlength=&quot;100&quot;>
<INPUT type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Share Images&quot;>
</FORM>
-------------------------------------------------------
THE POPUP CODE:
<html><title>Address Book</title><head>
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;dolphin1.css&quot;>
<script language=javascript>
function updateField(str) {
window.opener.f1.txtUserName.value = str;
window.close();
}
</script>
</head>

<body>
<br>
<table align=center bgcolor=#ffffff border=0 cellspacing=0>
<tr>
<td>
<a class=tabsel2>Address Book</a><br>
<img src=&quot;images/graph1.jpg&quot; align=&quot;top&quot; height=2 width=&quot;100%&quot;>
</td>
</tr>
<tr>
<td align=left>
<a href=&quot;javascript:updateField('test@test.com')&quot;>
<font size=2pt>test@test.com</font></a>
</td>
</tr>
<TABLE>
</BODY>
</HEAD>
</HTML>
-----------------------------------------
THE FRAMESET CODE:
<frameset rows=&quot;100,*,23&quot; FRAMESPACING=&quot;0&quot; TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot; MARGINHEIGHT=&quot;0&quot; MARGINWIDTH=&quot;0&quot;>
<frame name=&quot;topframe&quot; src=&quot;headerframe.asp&quot; noresize scrolling=&quot;no&quot; frameborder=&quot;no&quot; TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot; MARGINHEIGHT=&quot;0&quot; MARGINWIDTH=&quot;0&quot; target=&quot;_top&quot;>
<frameset cols=&quot;220,*&quot; border=&quot;0&quot; frameborder=&quot;1&quot; FRAMESPACING=&quot;3&quot; TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot; MARGINHEIGHT=&quot;0&quot; MARGINWIDTH=&quot;0&quot;>

<frameset rows=&quot;100%, 0%&quot; border=&quot;0&quot; frameborder=&quot;1&quot; FRAMESPACING=&quot;0&quot; TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot; MARGINHEIGHT=&quot;0&quot; MARGINWIDTH=&quot;0&quot;>
<frame name=&quot;contents&quot; style=&quot;border-left:0px solid white; border-top:0px solid white; border-bottom:0px solid white&quot; target=&quot;contents&quot; TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot; MARGINHEIGHT=&quot;0&quot; MARGINWIDTH=&quot;0&quot; FRAMEBORDER=&quot;no&quot; BORDERCOLOR=&quot;#B9C6F1&quot; scrolling=&quot;yes&quot; src=&quot;summary.asp?NOTEID=<%=new_note_id%>&quot;>
<frame name=&quot;note_use&quot; style=&quot;border-left:0px solid white; border-top:0px solid white; border-bottom:0px solid white&quot; target=&quot;contents&quot; TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot; MARGINHEIGHT=&quot;0&quot; MARGINWIDTH=&quot;0&quot; FRAMEBORDER=&quot;no&quot; BORDERCOLOR=&quot;#B9C6F1&quot; scrolling=&quot;yes&quot; src=&quot;note_use.asp&quot;>
</frameset>
<frame name=&quot;main&quot; FRAMEBORDER=&quot;no&quot; scrolling=&quot;yes&quot; BORDERCOLOR=&quot;#B9C6F1&quot; src=&quot;slides.asp&quot;>
</frameset>
<frame name=&quot;bottom&quot; scrolling=&quot;no&quot; noresize target=&quot;contents&quot; src=&quot;footerframe.html&quot; frameborder=&quot;no&quot; TOPMARGIN=&quot;0&quot; LEFTMARGIN=&quot;0&quot; MARGINHEIGHT=&quot;0&quot; MARGINWIDTH=&quot;0&quot;>
</frameset>
 
You may have an issue with the opener referring to the frame page rather than the right frame. I don't work with frames too much...

window.opener.f1.txtUserName.value = str;

may need to be...

window.opener.rightFrameName.f1.txtUserName.value = str;

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Nevermind! I figured it out. If anyone else needs the answer here it is:

I modified the function in the pop-up as follows:

function updateField(str) {
window.opener.document.f1.txtUserName.value = str;
window.close();
}

 
damn I was close...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top