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怎么去掉空格

html之head头部的实现

怎么用html写hello world

html的头部有什么元素

手把手教你使用css给html字体添加边框效果(代码分享)

在html中有哪些引用css的方式

怎么在head区域引入css

html中hr怎么设置粗细

html colgroup标签怎么用

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




打赏

取消

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

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

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

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

评论

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