JavaScript 各种参数 详解(十一)

230.在页面上画点

function a(x,y,color)

{

document.write("<img border='0' style='position: absolute; left: "+(x+20)+"; top:

 

"+(y+20)+";background-color: "+color+"' width=1 height=1>")

}//

 

231.自动关闭网页

<script LANGUAGE="javascript">

<!--

setTimeout('window.close();', 10000); //60秒后关闭

// -->

</script>

<p align="center">本页10秒后自动关闭,请注意刷新页面</p>

 

*************************************************************************************

 

函数收藏

 

 

程序代码

 

'*******************************************************************

'检测是否是手机浏览

'*******************************************************************

<%

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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值