zoukankan      html  css  js  c++  java
  • Ajax实现表单验证

    <script type="text/javascript">
            var xmlhttp;
            function init(){
                if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }else{// code for IE6, IE5
                      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
            }
            function callback(){
                if(xmlhttp.readyState==4 && xmlhttp.status==200){
                    document.getElementById("tishi").innerHTML=xmlhttp.responseText;
                }
            }
            function yanzheng(){
                var name=document.getElementById("name").value;
                xmlhttp.onreadystatechange=callback;
                xmlhttp.open("GET","yanzheng.action?name="+name,true);
                xmlhttp.send(null);
            }
            window.onload=init;
        </script>
  • 相关阅读:
    2.8
    2.7
    2.6
    2.5
    2.4第三篇读后感
    2.2第一篇读后感
    2.1
    字符统计
    6468: Snuke's Coloring
    6463: Tak and Hotels II
  • 原文地址:https://www.cnblogs.com/yiban/p/ajax_yanzheng.html
Copyright © 2011-2022 走看看