• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • ASP.Net 1.x 中 __doPostBack實現的問題

    發表于:2007-06-30來源:作者:點擊數: 標簽:
    ASP.Net 1.x的client side postback script是這樣的: !-- function __doPostBack(eventTarget, eventArgument) { var theform; if (window.navigator.appName.toLowerCase().indexOf(quot;) -1) { theform = document.forms[Form1]; } else { theform = docu
    ASP.Net 1.x的client side postback script是這樣的:
    <!--
    function __doPostBack(eventTarget, eventArgument) {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf(".netscape") > -1) {
    theform = document.forms["Form1"];
    }
    else {
    theform = document.Form1;
    }
    theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
    theform.__EVENTARGUMENT.value = eventArgument;
    theform.submit();
    }
    // -->

    它是通過form.submit()去submit的。這樣就有一個問題,form.onsubmit事件不會被觸發,這么一來可能有些client side validation script就被繞過了。在ASP.Net 2.0里,這個問題被fix了。對于ASP.Net 1.x,據我所知,SP1也沒有解決這個問題。我們可以使用下面的代碼解決這個問題:

    string myDoPostBack = @"
    <script language=""javascript"">
    <!--
    function __myDoPostBack(eventTarget, eventArgument) {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf(""netscape"") > -1) {
    theform = document.forms[""Form1""];
    }
    else {
    theform = document.Form1;
    }
    theform.__EVENTTARGET.value = eventTarget.split(""$"").join("":"");
    theform.__EVENTARGUMENT.value = eventArgument;
    if ((typeof(theform.onsubmit) == ""function"") && theform.onsubmit()!=false) {
    theform.submit();
    }

    }
    __doPostBack = __myDoPostBack
    // -->
    </script>";
    RegisterStartupScript("myDoPostBack", myDoPostBack);



    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>