Opening link in parent window from pop up

I need to have a link open in the parent window after opeining one on my site.
What the user does, is he/she clicks a link in their browser. that intern opens another window with a input field and a submit button. after they hit submit, i want the next page to load in the window they first clicked the link for the pop up.
how would i do this?

Should be parent.window.location=URL

or
parent.window.open(parameters)

so in the input tag should i have this?

<input type="submit" onClick="parent.window.location=/add_mail.php">

and what should i have in the action part of the <form> tag?

That’s wrong…

top.window.opener.location.href=‘blah.php’

so what should the tag look like?

<a href=“javascript:window.opener.location.href=‘blah.php’;”>Open Blah Page</a>

this needs to happen when i submit a form.
so would

<input type="submit" onClick="javascript:window.opener.location.href='blah.php';">

work?
hmm… it put a space into javascript…

yeah, that’s fine :slight_smile:

hmm… it almost works.
it’s opening that file in the parent window, but it’s not sending the form value along with it.

Oh you want it submitted to that window?


<form action="blah.php" method="post" target="mainwindow">

ok, this almost works.
now it doesn’t load in the pop-up window, but it doesn’t load in the window that that pop up came from either.
it opens a new full browser window.

also, if i put a self.close() in with the submit button, will it submit the info then close the pop up?

anybody have an idea??

Sorry mate… I’m stumped…

The only thing I can think of is to have all the form elements in your parent window as well and to have a function to transfer the data from the form in the popup to the main form, then submit that form, then close the window…

Have you tried target=“_parent”?

lemme try.

nope, loads in the pop up window.

btw, if i put

onClick="javascript:self.close()"

in the submit tag, woudl it close the window AFTER the info was sent?
i can deal with that second popup, but i really wanna close the first so they don’t submit the info twice.

grrr! why does vB put a space in javascript when you use the code tag?

To prevent malicious mischief.

So any ideas on what i posted up ther?

I am dealing with something similar in my work now, which is how I found this discussion.

The “_parent” reserved target name only applies to the parent FRAME, not popup windows. The browser makers have not caught on to theis little problem.

You might try giving your parent window a name like this.

<body Onload=“window.name = ‘WhosYourDaddy’;”>

then target your form to target=“WhosYourDaddy”

Anyway, that is what I am trying to do now…

I’ll letcha know if it ISN’tT on the right track.

Now I’ve got a question:

Is it better (faster, less processing time, etc.) to use an inline script like this:

<a href="java script:window.open('image_640.asp?img=<%= image_file %>',scrollbars=no,menubar=no, width=640, height=480);">

or use a function like so:


function open640(URL) {
window.open(URL,"thisName","'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,directories=0,height=640,width=480,left = 0,top = 0'");}

<a href="java script:open640('image_640.asp?img=<%= image_file %>');">

???