Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

How to open a new window OnSubmit (JavaScript, ASP, etc.)

How to open a new window OnSubmit



9:36 am on Jan 18, 2004 (gmt 0)

10+ Year Member


I'm trying to create a form that will open a new browser window when the user clicks submit, simultaneously passing the values from the form to the new window, and the new window has no toolbar or address bar. I don't want to send the values (variables) from the form to the new window using the address (ex. default.html?Username=blah). Anyone knows how to tackle this?


1:09 pm on Jan 18, 2004 (gmt 0)

10+ Year Member

<a href="javascript:window.open('[YourURL]','[YourWindowName]','[WindowOption1],[WindowOption2],etc...');"

Common window options are:
width=(in pixels, e.g. 350)
height=(in pixels)

<a href="" OnClick="window.close()">Close Window</a>


8:41 pm on Jan 26, 2004 (gmt 0)

10+ Year Member

Hi there,
I tried adding enctype="application/x-www-form-urlencoded" to the <FORM> tag but it made no difference on Netscape.
The code submitted in the previous post by thehittmann is perfectly fine for hyperlinks but will not pass in form variables to the new window unfortunately.
You need to submit your form using POST instead of GET and the URL of the new window being opened will need to be a JSP, ASP, PHP or PL script that will read the variables and do whatever you want with them. Using GET instead of POST will display the variables in the URL-bar as you suggested which is not very nice at all so use method="post" in your form being submitted.

Hope this helps,
Sean Kelly

[edited by: tedster at 8:09 pm (utc) on Jan. 27, 2004]
[edit reason] remove sig file [/edit]


1:30 pm on Jan 27, 2004 (gmt 0)

10+ Year Member

Try this:
<FORM method=POST action="[URL]" target="_top">

Not sure if it works in all browsers, though...


7:02 pm on Jan 29, 2004 (gmt 0)

10+ Year Member

Sorry, I meant:

<FORM method=POST action="[URL]" target="_blank">


Featured Threads

Hot Threads This Week

Hot Threads This Month