I want to open new url as a popup window on form submission. Can you please help me .
+1
A:
The FORM tag allows an onSubmit event handler which you can process JavaScript in.
You could do something like
<form ... onsubmit="return submitWindow">
</form>
And the JavaScript for opening the window
<script>
function submitWindow() {
..
// URL, name and attributes
window.open('http://www.stackoverflow.com','windowNew','width=300, height=300');
return true;
}
Have a look at for more information on onSubmit: http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html
You could also add the window.open on your submit button using the onClick event.
Sam
2010-07-08 08:04:53
A:
function open_win(url_add)
{
window.open(url_add,'welcome',
'width=300,height=200,menubar=yes,status=yes,
location=yes,toolbar=yes,scrollbars=yes');
}
<form onsubmit="open_win('http://url')" ...>
If you want to submit the form depending popup open, then you must return true/false from the respective function(here open_win(url_add)). And you have to use the return keyword on submit attr like - onsubmit="return open_win('url')
Sadat
2010-07-08 08:05:13
A:
use target attribute for form
<form ... onsubmit="return submitWindow" target="_new">
</form>
Salil
2010-07-08 08:06:34