2007-09-20

有用的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 ("")   
  33. End Sub     
  34.   
  35.  程序代码   
  36. '*******************************************************************   
  37. ' 返回上一页,一般用在判断信息提交是否完全之后   
  38. '*******************************************************************   
  39. Sub GoBack()   
  40. Response.write ("")   
  41. End Sub    
  42.   
  43.  程序代码   
  44. '*******************************************************************   
  45. ' 重定向另外的连接   
  46. '*******************************************************************   
  47. Sub Go(url)   
  48. Response.write ("")   
  49. End Sub   
  50.      
  51.  程序代码   
  52. '*******************************************************************   
  53. ' 指定秒数重定向另外的连接   
  54. '*******************************************************************   
  55. sub GoPage(url,s)   
  56. s=s*1000   
  57. Response.Write ""  
  58. Response.Write "window.setTimeout("&chr(34)&"window.navigate('"&url&"')"&chr(34)&","&s&")"  
  59. Response.Write ""  
  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.  
  175.  
  176.  
  177.  
  178.  
  179. G1
     
  180. good morning
     
  181.  
  182.  
  183.  
  184.  
  185.  
  186. G2
     
  187. good evening
     
  188.  
  189.  
  190.  
  191.  
  192.  
  193. M1
     
  194. my name is mozart0
     
  195.  
  196.  
  197.  
  198.  
  199.  
  200. M2
     
  201. mm mm i love u
     
  202.  
  203.  
  204.  
  205.  
  206.  
  207. G1
     
  208. good morning
     
  209.  
  210.  
  211.  
  212.  
  213.  
  214. G2
     
  215. good evening
     
  216.  
  217.  
  218.  
  219.  
  220.  
  221. M1
     
  222. my name is mozart0
     
  223.  
  224.  
  225.  
  226.  
  227.  
  228. M2
     
  229. mm mm i love u
     
  230.  
  231.  
  232.  
  233.   
评论
发表评论

您还没有登录,请登录后发表评论

chinapkw
搜索本博客
我的相册
E1f6c51e-d56f-3e0c-8eff-bb74946582d0-thumb
error
共 5 张
最近加入圈子
存档
最新评论