asp函数收藏

时间:2009-04-21 13:10:00 


'*******************************************************************
'检测是否是手机浏览
'*******************************************************************
〈%
if instr(request.ServerVariables("HTTP_USER_AGENT"),"Mozilla")=0 then
response.redirect "/wap" '如果客户端为手机访问,则进入/wap目录
else
response.redirect "http://wap.fz0132.com"/ '如果客户端不是手机访问,则进入指定地址
end if
%>



'*******************************************************************
'取得IP地址
'*******************************************************************
Function Userip()
Dim GetClientIP
'如果客户端用了代理服务器,则应该用ServerVariables("HTTP_X_FORWARDED_FOR")方法
GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If GetClientIP = "" or isnull(GetClientIP) or isempty(GetClientIP) Then
'如果客户端没用代理,应该用Request.ServerVariables("REMOTE_ADDR")方法
GetClientIP = Request.ServerVariables("REMOTE_ADDR")
end if
Userip = GetClientIP
End function


'*******************************************************************
' 弹出对话框
'*******************************************************************
Sub alert(message)
message = replace(message,"'","\'")
Response.Write ("〈script>alert('" & message & "')〈/script>")
End Sub
 


'*******************************************************************
' 返回上一页,一般用在判断信息提交是否完全之后
'*******************************************************************
Sub GoBack()
Response.write ("〈script>history.go(-1)〈/script>")
End Sub
 


'*******************************************************************
' 重定向另外的连接
'*******************************************************************
Sub Go(url)
Response.write ("〈script>location.href('" & url & "')〈/script>")
End Sub
 


'*******************************************************************
' 指定秒数重定向另外的连接
'*******************************************************************
sub GoPage(url,s)
s=s*1000
Response.Write "〈SCRIPT LANGUAGE=JavaScript>"
Response.Write "window.setTimeout("&chr(34)&"window.navigate('"&url&"')"&chr(34)&","&s&")"
Response.Write "〈/script>"
end sub


'*******************************************************************
' 判断数字是否整形
'*******************************************************************
function isInteger(para)
on error resume next
dim str
dim l,i
if isNUll(para) then
isInteger=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isInteger=false
exit function
end if
l=len(str)
for i=1 to l
if mid(str,i,1)>"9" or mid(str,i,1)〈"0" then
isInteger=false
exit function
end if
next
isInteger=true
if err.number〈>0 then err.clear
end function
 


'*******************************************************************
' 获得文件扩展名
'*******************************************************************
function GetExtend(filename)
dim tmp
if filename〈>"" then
tmp=mid(filename,instrrev(filename,".")+1,len(filename)-instrrev(filename,"."))
tmp=LCase(tmp)
if instr(1,tmp,"asp")>0 or instr(1,tmp,"php")>0 or instr(1,tmp,"php3")>0 or instr(1,tmp,"aspx")>0 then
getextend="txt"
else
getextend=tmp
end if
else
getextend=""
end if
end function
 

标签:收藏,函数,asp
0
投稿

猜你喜欢

  • Javascript实现的鼠标经过时播放声音

    2010-05-18 20:03:00
  • Asp的上下午时间格式问题

    2009-04-13 16:06:00
  • 在ASP与ASP.NET之间共享对话状态(1)

    2008-09-02 12:18:00
  • Active Server Pages 错误 “ASP 0141”

    2009-08-19 17:10:00
  • 引起用户注意的界面方式

    2007-10-07 21:17:00
  • Opera浏览器简介

    2009-02-05 20:56:00
  • Access数据库安全问答

    2007-08-23 15:28:00
  • 使用access数据库时可能用到的数据转换

    2008-09-10 12:49:00
  • 在SQL 2005中实现循环每一行做一定的操作

    2009-03-05 14:57:00
  • 如何获取机器的网络配置属性?

    2009-11-23 20:44:00
  • 回答XML与HTML的区别

    2007-12-03 10:58:00
  • ASP中使用Form和QueryString集合

    2007-09-14 10:43:00
  • 别开生面:纯CSS实现相册滑动浏览

    2008-06-26 13:24:00
  • Microsoft VBScript 运行时错误 错误 800a0005 无效的过程调用或参数: chr

    2011-03-09 11:03:00
  • 提醒各位一下,IE透明会失效的

    2009-03-31 12:48:00
  • 轻松接触MaxDB和MySQL之间的协同性

    2008-11-27 16:25:00
  • SQL Server 自动增长清零的方法

    2012-01-05 19:07:47
  • HTML在线编辑器的原理分析(整理)

    2007-12-22 10:25:00
  • 如何动态产生变量?

    2009-11-18 16:33:00
  • ASP 高级模板引擎实现类

    2011-03-25 10:54:00
  • asp之家 网络编程 m.aspxhome.com