只有 IE 才有的 Bug or feature?

IE 对于以下两种情况的处理是不一样的:

  • 页面上只有一个 text box,当输入焦点在这个 text box 中时按下 Enter 键
  • 页面上包含多个 text box,当输入焦点在这个 text box 中时按下 Enter 键

对于上述情况,在 MSDN 中只用了两句话进行描述:
If the form includes only one text box and the user presses ENTER, the onsubmit event fires. If the form has an INPUT type=submit element, it will appear as a button with a dark border, which indicates the user can press ENTER to submit the form.
注:来自 http://msdn.microsoft.com/en-us/library/ms535249(VS.85).aspx

CSDN 上有相关的讨论,具体见 http://topic.csdn.net/t/20061128/14/5191186.html
个人感觉比较简便的解决方法是当页面上只有一个 text box时,再加一个<input   style="display:none">

posted on 2008-09-19 14:42  CsharpStyle  阅读(130)  评论(0编辑  收藏  举报