当前位置:首页 > 网络编程 > WEB编程 > 其它 > 个人站长制做网页常用代码集锦(七)

个人站长制做网页常用代码集锦(七)

点击次数:23 次 发布日期:2008-11-26 20:16:37 作者:源代码网
源代码网推荐

函数收藏

*******************************************************************
源代码网推荐"检测是否是手机浏览
源代码网推荐"*******************************************************************
源代码网推荐<%
源代码网推荐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


源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华