zoukankan      html  css  js  c++  java
  • 每日总结

    1.php 的AJAX

    AJAX 是一种用于创建快速动态网页的技术。

    AJAX 通过在后台与服务器进行少量数据交换,使网页实现异步更新。

    <html>
    <head>
    <script>
    function showHint(str)
    {
        if (str.length==0)
        { 
            document.getElementById("txtHint").innerHTML="";
            return;
        }
        if (window.XMLHttpRequest)
        {
            // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行的代码
            xmlhttp=new XMLHttpRequest();
        }
        else
        {    
            //IE6, IE5 浏览器执行的代码
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
                document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","gethint.php?q="+str,true);
        xmlhttp.send();
    }
    </script>
    </head>
    <body>
    
    <p><b>在输入框中输入一个姓名:</b></p>
    <form> 
    姓名: <input type="text" onkeyup="showHint(this.value)">
    </form>
    <p>返回值: <span id="txtHint"></span></p>
    
    </body>
    </html>
  • 相关阅读:
    模拟赛12-10
    uva-11235
    中国剩余定理
    待学算法
    A
    动态逆序对
    [BZOJ3011][Usaco2012 Dec]Running Away From the Barn
    题目1007:奥运排序问题(结构体排序)
    题目1006:ZOJ问题(字符串处理)
    题目1005:Graduate Admission(结构体排序)
  • 原文地址:https://www.cnblogs.com/chenghaixiang/p/14912363.html
Copyright © 2011-2022 走看看