今天写ajax程序时,需要重新从后台加载数据,所以用了__doPostBack方法。 __doPostBack并不是我自己写的方法,是由asp.net 自己加入页面中的方法。我们运行Asp.net程序后,会在生成的html源码中看到__doPostBack方法,其代码如下:

 

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

相关文章: