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中id属性和name属性的区别是什么

html怎么隐藏a标签

html最外层元素是什么?

html怎么加载css

js怎么去掉html标签

html指什么

html的网页错位原因以及解决方法

用html中标签制作表单实例

html怎么去掉元素的边框

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




打赏

取消

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

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

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

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

评论

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