homepage Welcome to WebmasterWorld Guest from 54.145.243.51
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

    
Opening a page in the same window with a form submit
window.open, _self, submit
Gopinath

5+ Year Member



 
Msg#: 3851361 posted 10:58 am on Feb 17, 2009 (gmt 0)

Hi,

Is there a way I can open a page in the current window when I do a form submit?

Here is my code.
</HEAD>
<BODY>
<form name="airForm" id="airForm" onsubmit=fun()>
<input type="submit" value="Submit">
</form>
</BODY>
</HTML>
<script language="javascript">
function fun(){
window.open("http://google.com", "_self");
}
</script>

It works fine if I change the 'submit' to a 'button'.

<form name="airForm" id="airForm" >
<input type="button" value="Submit" onClick=fun()>
</form>

Thanks for any help.
Abhilash

[edited by: Gopinath at 11:04 am (utc) on Feb. 17, 2009]

 

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3851361 posted 1:36 pm on Feb 17, 2009 (gmt 0)

Welcome to WebmasterWorld, Gopinath.

A form submit stays in the same window. No need to be using JavaScript.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
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