真是一個(gè)很怪的缺省操作啊!

 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>

運(yùn)行上面的html文件,在text中輸入內(nèi)容,然后回車,這個(gè)頁(yè)面將會(huì)自動(dòng)提交表單。即使我在這個(gè)頁(yè)面中增加file,checkbox,hidden等的控件,這個(gè)頁(yè)面還是會(huì)自動(dòng)提交。這是IE的一個(gè)缺省操作。如果想改變這個(gè)缺省操作,我們可以再增加一個(gè)text,然后隱藏這個(gè)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