ASP编程中20个非常有用的例子

如何用Asp判断你的网站的虚拟物理路径

  答:使用Mappath方法

< p align="center" >< font size="4" face="Arial" >< b >
The Physical path to this virtual website is:
< /b >< /font >
< font color="#FF0000" size="6" face="Arial" >
< %= Server.MapPath("/")% >
< /font >< /p >

  2.我如何知道使用者所用的浏览器?

  答:使用the Request object方法

strBrowser=Request.ServerVariables("HTTP_USER_AGENT")
If Instr(strBrowser,"MSIE") < > 0 Then
  Response.redirect("ForMSIEOnly.htm")
Else
  Response.redirect("ForAll.htm")
End If

  3.如何计算每天的平均反复访问人数

  答:解决方法

< % startdate=DateDiff("d",Now,"01/01/1990")
if strdate< 0 then startdate=startdate*-1
avgvpd=Int((usercnt)/startdate) % >

  显示结果

< % response.write(avgvpd) % >
that is it.this page have been viewed since November 10,1998

  4.如何显示随机图象

< % dim p,ppic,dpic
ppic=12
randomize
p=Int((ppic*rnd)+1)
dpic="graphix/randompics/"&p&".gif"
% >
显示
< img src="< %=dpic% >" >

  全文阅读: ASP编程中20个非常有用的例子
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值