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单选按钮默认选中怎么做?input标签的单选按钮用法实例

html怎么让图片变亮

html设置表格边框样式

怎么设计自己的网页

html 教程

html文本域标签属性有哪些?html文本域标签属性用法介绍

html标题,段落,换行,水平线,特殊字符应该如何使用

html控件怎么实现隐藏

html blockquote标签怎么用

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




打赏

取消

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

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

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

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

评论

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