首页 > Web开发 > 详细

html页面内容替换

时间:2016-02-18 10:02:24      阅读:232      评论:0      收藏:0      [点我收藏+]
//前台提交
 <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());
                
            }
在表单中插入隐藏域的目的在于收集或发送信息,以利于被处理表单的程序所使用。浏览者单击发送按钮发送表单的时候,隐藏域的信息也被一起发送到服务器。

  

html页面内容替换

原文:http://www.cnblogs.com/zhubenxi/p/5197160.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!