zoukankan      html  css  js  c++  java
  • html页面内容替换

    //前台提交
     <form action="a.ashx" method="post">
    <input type="hidden" name="hidden" value="4" /> 
    @x
    <input type="submit" value="click" id="@x"/> 
    </form>
    
    ashx替换@x
     string path = context.Request.MapPath("a.html");
            string html = System.IO.File.ReadAllText(path);
            //判断页面是否是第一次加载 
            
                //点击按钮 post 
                //获取隐藏域的值 
                string s = context.Request.Form["hidden"];
                if (int.TryParse(s, out n))
                {
                    n++;
                    html = html.Replace("@x", n.ToString());
                    
                }
    在表单中插入隐藏域的目的在于收集或发送信息,以利于被处理表单的程序所使用。浏览者单击发送按钮发送表单的时候,隐藏域的信息也被一起发送到服务器。
    

      

  • 相关阅读:
    视图
    触发器
    DNS
    DHCP
    SSH 详解
    apt-get
    java split
    数组指针 指针数组
    函数指针
    网络协议
  • 原文地址:https://www.cnblogs.com/zhubenxi/p/5197160.html
Copyright © 2011-2022 走看看