zoukankan      html  css  js  c++  java
  • 静态局部刷新参考代码

    function $(id) {
        if (id != null || id != "") {
            return document.getElementById(ClientIDPrefix + id);
        }
    }
    
    function Get() {
    
        if ($("txt").value == "") {
            $("lbl").value = "";
            return;
        }
        var xmlhttp;
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        }
        else {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var str = xmlhttp.responseText;
                $("lbl").value = str;
                $("lbl").title = str;
            }
        }
        xmlhttp.open("GET", location.href + "?txtNeirong=" + $("txt").value + "", true);
        xmlhttp.send();
    
    }

    以上是前台

    下面是后台

     protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            }
                Ajax();
            }
        }
    
     private void Ajax()
        {
            string str= Request["txtNeirong"] ?? "";
            if (!string.IsNullOrEmpty(str))
            {
                    Response.Write(“lblNeirong”);
                    Response.End();
            }
            else
            {
                    Response.Write(string.Empty);
                    Response.End();//????
            }
      }

     UpdatePanel?

     asp后台设置颜色?不刷新?

  • 相关阅读:
    SQL通用数据类型
    SQL基础
    软件测试相关(1)
    C语言——判断
    C语言新手教程——计算
    并查集
    洛谷-P1551 亲戚
    洛谷-P1536 村村通
    洛谷-P1525 [NOIP2010 提高组] 关押罪犯
    洛谷-P2814 家谱
  • 原文地址:https://www.cnblogs.com/flying607/p/3290577.html
Copyright © 2011-2022 走看看