日期:2014-05-17  浏览次数:20482 次

html页面数据提交问题
HTML code

   <input type="submit" value=" 保存" onclick="javascript:__doPostBack(&#39;ctl00$MainContent$toolbarPersonEdit&#39;,&#39;Save$&#39;)" id="MainContent_Save" class="saveButtonIco" />



JScript code

   <script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>



ie8提交两次,ie9,火狐,谷歌提交一次。
我知道type="submit" 会提交表单,__doPostBack也会提交表单,那为什么偏偏只有ie8提交了两次??

------解决方案--------------------
<input type="submit" value=" 保存"
改成
 <input type="button" value=" 保存"

否则,既执行onlick,又执行submit。浏览器存在bug,不建议使用 <input type="submit"又写onlick