真是一個很怪的缺省操作啊!

 1<html>
 2<head>
 3<title>test</title>
 4<script language="javascript">
 5</script>
 6</head>
 7<body>
 8<form name="test" method="post" action="test.htm">
 9<input type='button' value='test' onclick="javascript:test()"> 
10<input type="text"   name="textfield"   class="input">
11</form>
12</body>
13</html>

運行上面的html文件,在text中輸入內(nèi)容,然后回車,這個頁面將會自動提交表單。即使我在這個頁面中增加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