找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 14847|回复: 1

ASP中几种判断

[复制链接]
发表于 2009-11-29 01:55:10 | 显示全部楼层 |阅读模式 IP:江苏扬州
程序代码

'*******************************************************************
'检测是否是手机浏览
'*******************************************************************
<%
if instr(request.ServerVariables("HTTP_USER_AGENT"),"Mozilla")=0 then
   response.redirect "/wap" '如果客户端为手机访问,则进入/wap目录
else
   response.redirect "http://wap.hxblog.net" '如果客户端不是手机访问,则进入指定地址
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

 

程序代码
' *----------------------------------------------------------------------------
' * 函数:CheckIn
' * 描述:检测参数是否有SQL危险字符
' * 参数:str要检测的数据
' * 返回:FALSE:安全 TRUE:不安全
' * 作者:
' * 日期:
' *----------------------------------------------------------------------------
function CheckIn(str)
if instr(1,str,chr(39))>0 or instr(1,str,chr(34))>0 or instr(1,str,chr(59))>0 then
CheckIn=true
else
CheckIn=false
end if
end function



程序代码
' *----------------------------------------------------------------------------
' * 函数:HTMLEncode
' * 描述:过滤HTML代码
' * 参数:--
' * 返回:--
' * 作者:
' * 日期:
' *----------------------------------------------------------------------------
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")

fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")

HTMLEncode = fString
end if
end function



程序代码
'*----------------------------------------------------------------------------
' * 函数:HTMLcode
' * 描述:过滤表单字符
' * 参数:--
' * 返回:--
' * 作者:
' * 日期:
' *----------------------------------------------------------------------------
function HTMLcode(fString)
if not isnull(fString) then
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
fString = Replace(fString, CHR(34), "")
fString = Replace(fString, CHR(10), "<BR>")
HTMLcode = fString
end if
end function



so cool 菜单(Jave)

程序代码
<style>
body{
     background-color:#B8B8A0;
     }
#fbtn{
     display:none;
     overflow:hidden;
     border-style:solid;
     border-width:1px;
     border-color:#e1e1c9 #e1e1c9 #6e6e56 #6e6e56;
     padding:1 1 1 1;
     width:115px;
     height:30px;
     }
#fbtn_txt{
     position:relative;
     }
#fbtn_txt div{
     height:30px;
     padding-top:11px;
     font-size:9px;
     font-family:small fonts;
     color:#800080;
     text-align:center;
     cursor:hand;
     }
#fbtn_mask{
     background-color:#ffffff;
     position:relative;
     width:100%;
     height:100%;
     }
</style>

<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>G1</div>
         <div>good morning</div>
     </div>
</div>
<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>G2</div>
         <div>good evening</div>
     </div>
</div>
<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>M1</div>
         <div>my name is mozart0</div>
     </div>
</div>
<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>M2</div>
         <div>mm mm i love u</div>
     </div>
</div>
<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>G1</div>
         <div>good morning</div>
     </div>
</div>
<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>G2</div>
         <div>good evening</div>
     </div>
</div>
<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>M1</div>
         <div>my name is mozart0</div>
     </div>
</div>
<div id=fbtn>
     <div id=fbtn_mask></div>
     <div id=fbtn_txt>
         <div>M2</div>
         <div>mm mm i love u</div>
     </div>
</div>

<script>
var current=null;
for(var i=0;i<fbtn.length;i++){
     fbtn_txt.style.posTop=-30;
     fbtn_mask.style.posTop=-30;
     fbtn.index=i;
     fbtn.style.display="block";
     fbtn.onmouseover=function(){
         if(!current){
             current=this;
             domove(this.index);
             }
         else if(current!=this){
             domove(current.index);
             domove(this.index);
             current=this;
             }
         }
     fbtn.onmouseout=function(){
         if(event.toElement==this.parentElement&¤t==this){
             domove(this.index);
             current=null;
             }
         }
     }
function domove(num){
     var o=fbtn_txt[num];
     var m=fbtn_mask[num];
     if(o.style.posTop<-60){
         o.style.display="none";
         var t=o.children[1].innerHTML;
         o.children[1].innerHTML=o.children[0].innerHTML;
         o.children[0].innerHTML=t;
         o.style.posTop=-30;
         o.style.display="block";
         if(m.style.posTop>30)
             m.style.posTop=-30;
         else
             m.style.posTop=0;
         }
     else{
         m.style.posTop+=3;
         o.style.posTop-=3;
         setTimeout('domove('+num+')',15);
         }
     }
</script>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 13:26 , Processed in 0.444659 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表