FireFox: strange behavior on submiting a form
Can anyone help with this strange form submiting in FireFox?
So this form should be submitted after pushing "go to submit" button. There is an onclick event on the button that should submit form through JavaScript. In the form there is another button "test" without any onclick event. Following the script, the form should be submitted only after pushing the "go to submit" button, but it submits even pushing at "test" butt开发者_JAVA技巧on.
In the Internet Explorer it works well! But this stupid FireFox browser behaves different.
Here is example of HTML page:
<script>
function func(){
document.form1.submit();
}
</script>
<form name="form1" method="post" action="somewhere.php">
<button>test</button>
<input type="button" value="go to submit" onclick="func();">
</form>
I have several buttons with <button onclick="...">option 1</button>
options. I want to fix strange submiting a form in FireFox. Help please!
http://www.w3schools.com/tags/tag_button.asp
The tag defines a push button.
Inside a button element you can put content, like text or images. This is the difference between this element and buttons created with the input element.
Always specify the type attribute for the button. The default type for Internet Explorer is "button", while in other browsers (and in the W3C specification) it is "submit".
精彩评论