open form in new popup window of small size [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this questionI want to open new url as a popup window on form submission. Can you please help me .
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.
source
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')
use target attribute for form
<form ... onsubmit="return submitWindow" target="_new">
</form>
精彩评论