真是一个很怪的缺省操作啊!
运行上面的html文件,在text中输入内容,然后回车,这个页面将会自动提交表单。即使我在这个页面中增加file,checkbox,hidden等的控件,这个页面还是会自动提交。这是IE的一个缺省操作。如果想改变这个缺省操作,我们可以再增加一个text,然后隐藏这个text。
If
you have a Web Form with just one single-line text input (even if there are
additional input fields, like CheckBoxLists, RadioButtonLists, DropDownLists,
and so on), hitting enter in the text input will not cause the Button Web
control's Click event to fire when using Internet Explorer
本文探讨了在使用Internet Explorer浏览器时,仅包含单行文本输入框的网页表单会默认提交的问题。即使添加了文件选择器、复选框或隐藏字段等额外控件,按Enter键仍然会导致表单提交。文章提供了避免此默认行为的方法。
157

被折叠的 条评论
为什么被折叠?



