欢迎光临
我们一直在努力

给网站添加一个注册表 之 “类的应用”-ASP教程,ASP应用

建站超值云服务器,限时71元/月

下面,我们用这个“注册表”类来写一个简单的“计数器”应用,代码如下:

pagecount.asp:

<!– #include file="registry_class_inc.asp" –>

<%

dim reg

set reg = new registryobject

reg.path = server.mappath("pagecount.xml")

const basecount = 8000 计数器基数

dim count

count = reg.readvalue("pagecount", "common", "count") 读取原有计数

if isnumeric(count) then

count = clng(count)

else

count = basecount

end if

if count < basecount then count = basecount

count = count + 1

reg.savevalue "pagecount", "common", "count", count 保存新计数

set reg = nothing

response.write("document.write (您是第 " & count & " 位来访者);") 显示计数

%>

test.htm:

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=gb2312">

<title>测试xml计数器</title>

</head>

<body>

<script language="javascript" src="pagecount.asp"></script>

</body>

</html>

相关文章:

给网站添加一个注册表 之 “类的设计”

给网站添加一个注册表 之 “类的实现”

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 给网站添加一个注册表 之 “类的应用”-ASP教程,ASP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章