Summary:
1. If there is only one input type = text in form, no matter whether there is a submit button, press enter in input to submit the form. If you do not want to press enter to submit, you need to add another input type = text, and then set display: none.
2. If there is more than one input type = text in the form, there must be a submit button before you can press enter to submit the form.
Buttons can be either input or button. They should be set to type = submit. If you only write button without type, type = button in IE and type = submit in ff.
3. If there is more than one input type = text in the form, and you want to press enter to submit the form, you do not want to see the native submit button on the page. For example, you want to connect to an image with Hover, and implement gorgeous verification and form submission through JS scripts ......
You can add an input type = submit and set display: none in form --But! This is only valid for FF and so on. In IE, it will be very tragic....... If you want IE to take effect, do the following:
<Input type = "Submit" style = "display: block; overflow: hidden; width: 0px; Height: 0px;Position: absolute">
Why do I have to use form's default carriage return to submit without listening to the keydown event in input? When code is 13, use javascirpt to call the form object's submit () method?
If your form targtet! = _ Blank, then you can implement what you want.
However, once target = _ blank, according to my practice, submit to _ blank in the keydown event
--This new window will be blocked by IE....... (By the way, if the form submit method is called in the click event, neither the current window nor the new window will be blocked in IE, suspected to be Ie's bullet-proof window advertising strategy)
The above effects can be achieved:Press enter to submit the query, new window, multiple input text, and no native button.
Original article: http://hi.baidu.com/wangworks/blog/item/92c30d11f4d91b0c213f2e3e.html