您现在的位置:中国下载站学院中心网络编程ASP教程Asp视频教程 → 文章列表

ASP入门基础教程- 保存应用程序信息

作者:佚名  来源:不详  发布时间:2007-4-14 11:04:58   

减小字体 增大字体

 
 
  一、使用 Contents 集合应用程序信息

  1、Contents 集合是由所有通过脚本语言添加到应用程序的变量和对象组成的集合。可以使用这个集合来获得给定的应用程序作用域的变量列表或指定某个变量为操作对象。Contents 集合是 Application 对象默认的集合,因此下述两种格式是等价的:

         Application.Contents("变量名")
         Application("变量名")

  其中,“变量名”是需要操作的 Application 变量名称。

  2、实例代码(1.asp):使用 Session 对象编写一个简单的计数器程序

<html>
<head><title>>Application.Contents集合的应用</title>
</head>
<body>
<center><h3>Application实例</h3><hr width="70%"></center>
<%
name=Request.Form("visitor")
i=Request.Form("chatno")
if name<>"" then
if i=0 then
Application("chinese")=Application("Chinese")+1
chat="中文"
elseif i=1 then
Application("English")=Application("English")+1
chat="英文"
end if
Response.write "<center>欢迎<b>" & name & "</b>,你是来到"
Response.write "<b>" & chat & "</b>讨论区的第"
if chat="中文" then
Response.write Application.Contents("Chinese") & "位客人。<p>"
else
Response.write Application.Contents("English") & "位客人。<p>"
end if
Response.write "<a href='4-6-2.asp'>返回</a></center>"
Response.end
end if
%>
<center>
<form method=post>
<table><tr><td>名字:<td><input type=text name="visitor" size=12>
<tr><td>讨论区:<td><Select name="Chatno">
<option value=0>中文</option>
<option value=1>英文</option>
</select>
<input type=submit value="确定">
</table>
</form>
</center>
</body>
</html>

  二、使用Application.StaticObjects 集合保存应用程序信息


在百度中搜索更多ASP入门基础教程- 保存应用程序信息相关网页 转贴于:中国下载站

  • 上一篇文章:ASP入门基础教程-防止或允许更改应用程序变量值
  • 下一篇文章:ASP入门基础教程-处理会话事件
  • 阅读统计:[]
  • 中国下载站】【设为主页】【收藏本页】【打印本文】【回到顶部】【关闭此页

    相关文章
    文章评论(评论内容只代表网友观点,与本站立场无关!)

    用户名: 查看更多评论

    分 值:100分 85分 70分 55分 40分 25分 10分 0分

    内 容:

             (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码


    设为首页 - 关于我们 - 广告服务 - 网站地图 - 加入收藏 - 网站声明 - 网站帮助 - 友情链接

    • Copyright (C) 2006-2008 www.cndownz.com All Rights Reserved.
      中国下载站 版权所有. 粤ICP备05141802号. 对本站有任何建议、意见或投诉,请来信:cndownzcom@yahoo.com.cn.
      喜欢中国下载站(cndownz.com),请把中国下载站(cndownz.com)告诉你QQ上的5位好友,多谢支持!