onchange 改变文本后失去焦点后触发
onpropertychange 改变文本后立即触发.

解决方案 »

  1.   

    L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
      <input type="text" id="txtInput" />
      <input type="hidden" id="hidValue" />
      <input type="button" id="btnShow" value="Show Value" />
      <script type="text/javascript">
      <!--
    function $(sId) {return document.getElementById(sId);}
    $("txtInput").onkeydown = function() {
    $("hidValue").value = this.value;
    };
    $("txtInput").onchange = function() {
    $("hidValue").value = this.value;
    };
    $("btnShow").onclick = function() {
    alert($("hidValue").value);
    };
      //-->
      </script>
     </body>
    </html>
      

  2.   


    我知道这个好用啊,可是我的Textbox中的值是通过document.getElementById(txtId).value=‘AAA;
    赋上去的,这时就不好用了
      

  3.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
      <input type="text" id="txtInput" />
      <input type="hidden" id="hidValue" />
      <input type="button" id="btnShow" value="Show Value" />
      <script type="text/javascript">
      <!--
    function $(sId) {return document.getElementById(sId);}
    $("txtInput").onkeydown = function() {
        $("hidValue").value = this.value;
    };
    $("txtInput").onchange = function() {
        $("hidValue").value = this.value;
        alert($("hidValue").value);
    };
    $("btnShow").onclick = function() {
    $("txtInput").value = "AAAA";
        //alert($("hidValue").value);
    };
      //-->
      </script>
     </body>
    </html>
    这是我想要的逻辑,可是现在不好用啊...