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

Targeting popupopener via form

Status
Not open for further replies.

pholst

Programmer
Joined
Apr 16, 2006
Messages
7
Location
DK
I have a popupwindow and i want to targeting the openerwindow with a form, beaucse i want to sent some information from inputs to another site. How to do? :/
 
When you open the popup, make sure you have a window name given as the second parameter:

Code:
window.open(someUrl, [!]'windowName'[/!], args);

then simply set the target of the form to that name:

Code:
<form [!]target="windowName"[/!] ...>

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hmm... I dont think it works...


This is my code to open the popup:



<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=700,height=770,scrollbars=yes');
return false;
}
//-->
</SCRIPT>

<a href="blomsterbilled.asp?id=5" onClick="return popup(this, 'notes')">text</a>


This is the form in the popup:

<form target="windowname" method="post" action="default.asp?mode=bestilling">


What is wrong?
 
Oh sorry, did not notice that i missed it.

Anyway, it seems like it still doesn't work.
It does not go back to the mainwindow, but just stay in the popupwindow and follows the link.

Do you know why?
 
I would like to use this:

<SCRIPT TYPE="text/javascript">
<!--
function targetopener(mylink, closeme, closeonly)
{
if (! (window.focus && window.opener))return true;
window.opener.focus();
if (! closeonly)window.opener.location.href=mylink.href;
if (closeme)window.close();
return false;
}
//-->
</SCRIPT>
<A HREF="mylink.html"
onClick="return targetopener(this)">my page</A>


But how can I make it work on a form?
 
So you want to submit to the opener, not to the popup? In which case, try this:

Code:
<form target="[!]_parent[/!]" method="post" action="default.asp?mode=bestilling">

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Sorry to say, I cant get it working... It is still staying in the popup window.
 
Dont you have any code witch gives the same results? I really want to get this working...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top