有用的js 代码

js 代码
  1. 函数收藏   
  2.   
  3.  程序代码   
  4.   
  5. '*******************************************************************   
  6. '检测是否是手机浏览   
  7. '*******************************************************************   
  8.     
  9.   
  10.  程序代码   
  11. '*******************************************************************   
  12. '取得IP地址   
  13. '*******************************************************************   
  14. Function Userip()   
  15. Dim GetClientIP   
  16. '如果客户端用了代理服务器,则应该用ServerVariables("HTTP_X_FORWARDED_FOR")方法   
  17. GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")   
  18. If GetClientIP = "" or isnull(GetClientIP) or isempty(GetClientIP) Then   
  19. '如果客户端没用代理,应该用Request.ServerVariables("REMOTE_ADDR")方法   
  20. GetClientIP = Request.ServerVariables("REMOTE_ADDR")   
  21. end if  
  22. Userip = GetClientIP   
  23. End function  
  24.   
  25.   
  26.  程序代码   
  27. '*******************************************************************   
  28. ' 弹出对话框   
  29. '*******************************************************************   
  30. Sub alert(message)   
  31. message = replace(message,"'","\'")   
  32. Response.Write ("<script>alert('" & message & "')</script>")   
  33. End Sub     
  34.   
  35.  程序代码   
  36. '*******************************************************************   
  37. ' 返回上一页,一般用在判断信息提交是否完全之后   
  38. '*******************************************************************   
  39. Sub GoBack()   
  40. Response.write ("<script>history.go(-1)</script>")   
  41. End Sub    
  42.   
  43.  程序代码   
  44. '*******************************************************************   
  45. ' 重定向另外的连接   
  46. '*******************************************************************   
  47. Sub Go(url)   
  48. Response.write ("<script>location.href('" & url & "')</script>")   
  49. End Sub   
  50.      
  51.  程序代码   
  52. '*******************************************************************   
  53. ' 指定秒数重定向另外的连接   
  54. '*******************************************************************   
  55. sub GoPage(url,s)   
  56. s=s*1000   
  57. Response.Write "<script language=javascript>"  
  58. Response.Write "window.setTimeout("&chr(34)&"window.navigate('"&url&"')"&chr(34)&","&s&")"  
  59. Response.Write "</script>"  
  60. end sub   
  61.   
  62.  程序代码   
  63. '*******************************************************************   
  64. ' 判断数字是否整形   
  65. '*******************************************************************   
  66. function isInteger(para)   
  67. on error resume next   
  68. dim str   
  69. dim l,i   
  70. if isNUll(para) then    
  71. isInteger=false  
  72. exit function  
  73. end if  
  74. str=cstr(para)   
  75. if trim(str)="" then   
  76. isInteger=false  
  77. exit function  
  78. end if  
  79. l=len(str)   
  80. for i=1 to l   
  81. if mid(str,i,1)>"9" or mid(str,i,1)<"0" then   
  82. isInteger=false    
  83. exit function  
  84. end if  
  85. next   
  86. isInteger=true  
  87. if err.number<>0 then err.clear   
  88. end function  
  89.      
  90.  程序代码   
  91. '*******************************************************************   
  92. ' 获得文件扩展名   
  93. '*******************************************************************   
  94. function GetExtend(filename)   
  95. dim tmp   
  96. if filename<>"" then   
  97. tmp=mid(filename,instrrev(filename,".")+1,len(filename)-instrrev(filename,"."))   
  98. tmp=LCase(tmp)   
  99. 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   
  100. getextend="txt"  
  101. else  
  102. getextend=tmp   
  103. end if  
  104. else  
  105. getextend=""  
  106. end if  
  107. end function  
  108.      
  109.  程序代码   
  110. ' *----------------------------------------------------------------------------   
  111. ' * 函数:CheckIn   
  112. ' * 描述:检测参数是否有SQL危险字符   
  113. ' * 参数:str要检测的数据   
  114. ' * 返回:FALSE:安全 TRUE:不安全   
  115. ' * 作者:   
  116. ' * 日期:   
  117. ' *----------------------------------------------------------------------------   
  118. function CheckIn(str)   
  119. if instr(1,str,chr(39))>0 or instr(1,str,chr(34))>0 or instr(1,str,chr(59))>0 then   
  120. CheckIn=true  
  121. else  
  122. CheckIn=false  
  123. end if  
  124. end function  
  125.   
  126.  程序代码   
  127. ' *----------------------------------------------------------------------------   
  128. ' * 函数:HTMLEncode   
  129. ' * 描述:过滤HTML代码   
  130. ' * 参数:--   
  131. ' * 返回:--   
  132. ' * 作者:   
  133. ' * 日期:   
  134. ' *----------------------------------------------------------------------------   
  135. function HTMLEncode(fString)   
  136. if not isnull(fString) then   
  137. fString = replace(fString, ">"">")   
  138. fString = replace(fString, "<""<")   
  139.   
  140. fString = Replace(fString, CHR(32), " ")   
  141. fString = Replace(fString, CHR(9), " ")   
  142. fString = Replace(fString, CHR(34), """)  
  143. fString = Replace(fString, CHR(39), "'")  
  144. fString = Replace(fString, CHR(13), "")  
  145. fString = Replace(fString, CHR(10) & CHR(10), "

     

     

    ")  
  146. fString = Replace(fString, CHR(10), "
     ")  
  147.  
  148. HTMLEncode = fString  
  149. end if  
  150. end function  
  151.  
  152.  程序代码  
  153. '*----------------------------------------------------------------------------  
  154. ' * 函数:HTMLcode  
  155. ' * 描述:过滤表单字符  
  156. ' * 参数:--  
  157. ' * 返回:--  
  158. ' * 作者:  
  159. ' * 日期:  
  160. ' *----------------------------------------------------------------------------  
  161. function HTMLcode(fString)  
  162. if not isnull(fString) then  
  163. fString = Replace(fString, CHR(13), "")  
  164. fString = Replace(fString, CHR(10) & CHR(10), "

     

     

    ")  
  165. fString = Replace(fString, CHR(34), "")  
  166. fString = Replace(fString, CHR(10), "
    ")  
  167. HTMLcode = fString  
  168. end if  
  169. end function  
  170.  
  171.  
  172. so cool 菜单(Jave)  
  173.  程序代码  
  174. <style type="text/css">  
  175. body{  
  176. background-color:#B8B8A0;  
  177. }  
  178. #fbtn{  
  179. display:none;  
  180. overflow:hidden;  
  181. border-style:solid;  
  182. border-width:1px;  
  183. border-color:#e1e1c9 #e1e1c9 #6e6e56 #6e6e56;  
  184. padding:1 1 1 1;  
  185. width:115px;  
  186. height:30px;  
  187. }  
  188. #fbtn_txt{  
  189. position:relative;  
  190. }  
  191. #fbtn_txt div{  
  192. height:30px;  
  193. padding-top:11px;  
  194. font-size:9px;  
  195. font-family:small fonts;  
  196. color:#800080;  
  197. text-align:center;  
  198. cursor:hand;  
  199. }  
  200. #fbtn_mask{  
  201. background-color:#ffffff;  
  202. position:relative;  
  203. width:100%;  
  204. height:100%;  
  205. }  
  206. </style> 
  207.  
  208.  
  209.  
  210.  
  211. G1
     
  212. good morning
     
  213.  
  214.  
  215.  
  216.  
  217.  
  218. G2
     
  219. good evening
     
  220.  
  221.  
  222.  
  223.  
  224.  
  225. M1
     
  226. my name is mozart0
     
  227.  
  228.  
  229.  
  230.  
  231.  
  232. M2
     
  233. mm mm i love u
     
  234.  
  235.  
  236.  
  237.  
  238.  
  239. G1
     
  240. good morning
     
  241.  
  242.  
  243.  
  244.  
  245.  
  246. G2
     
  247. good evening
     
  248.  
  249.  
  250.  
  251.  
  252.  
  253. M1
     
  254. my name is mozart0
     
  255.  
  256.  
  257.  
  258.  
  259.  
  260. M2
     
  261. mm mm i love u
     
  262.  
  263.  
  264.  
  265. <script>  
  266. var current=null;  
  267. for(var i=0;i<fbtn.length;i++){ <="" span=""> 
  268. fbtn_txt[i].style.posTop=-30;  
  269. fbtn_mask[i].style.posTop=-30;  
  270. fbtn[i].index=i;  
  271. fbtn[i].style.display="block";  
  272. fbtn[i].οnmοuseοver=function(){  
  273. if(!current){  
  274. current=this;  
  275. domove(this.index);  
  276. }  
  277. else if(current!=this){  
  278. domove(current.index);  
  279. domove(this.index);  
  280. current=this;  
  281. }  
  282. }  
  283. fbtn[i].οnmοuseοut=function(){  
  284. if(event.toElement==this.parentElement&¤t==this){  
  285. domove(this.index);  
  286. current=null;  
  287. }  
  288. }  
  289. }  
  290. function domove(num){  
  291. var o=fbtn_txt[num];  
  292. var m=fbtn_mask[num];  
  293. if(o.style.posTop<-60){  
  294. o.style.display="none";  
  295. var t=o.children[1].innerHTML;  
  296. o.children[1].innerHTML=o.children[0].innerHTML;  
  297. o.children[0].innerHTML=t;  
  298. o.style.posTop=-30;  
  299. o.style.display="block";   
  300. if(m.style.posTop>30)   
  301. m.style.posTop=-30;   
  302. else  
  303. m.style.posTop=0;   
  304. }   
  305. else{   
  306. m.style.posTop+=3;   
  307. o.style.posTop-=3;   
  308. setTimeout('domove('+num+')',15);   
  309. }   
  310. }   
  311. </script>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值