homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

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)


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)

<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)

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)

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)

Sorry, I meant:

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved