html中隐藏域hidden的作用介绍及使用示例


当前第2页 返回上一页

代码如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

int n = 0;

public void ProcessRequest (HttpContext context) {

context.Response.ContentType = "text/html";

 

string path = context.Request.MapPath("数值自增.htm");

string html = System.IO.File.ReadAllText(path);

//判断页面是否是第一次加载

string viewstate = context.Request.Form["_viewstate"];

if (!string.IsNullOrEmpty(viewstate))

{

//点击按钮 post

//获取隐藏域的值

string s = context.Request.Form["_p"];

if (int.TryParse(s, out n))

{

n++;

html = html.Replace("@n",n.ToString());

}

}

else

{

//页面首次加载,给p和p对应的隐藏域赋值

html = html.Replace("@n", n.ToString());

}

context.Response.Write(html);

}

以上就是html中隐藏域hidden的作用介绍及使用示例的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

html如何添加视频

浅谈html img标签中的srcset属性

html怎么设置图片长度

html标签中lang的作用

html dd标签怎么用

html param标签怎么用?html param标签属性实例详解

html中<input>标签的class属性的值及其使用方法总结

html hgroup标签怎么用

html隐藏标签是什么

html怎样实现页面跳转时传递参数

更多相关阅读请进入《hidden》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...