cAng^Er

不懂我的人 , 离不了我 , 该了解了解我 !而懂我的人 , 更离不了我 , 因为他们爱我 。

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  30 随笔 :: 16 文章 :: 18 评论 :: 0 Trackbacks
  1. 1.  oncontextmenu = "window.event.returnValue=false"  将彻底屏蔽鼠标右键 < table  border  oncontextmenu = return (false) > < td > no </ table >  可用于Table  
  2. 2.<body onselectstart="returnfalse">取消选取、防止复制  
  3. 3.onpaste = "returnfalse"  不准粘贴  
  4. 4. oncopy="return false;" oncut="return false;" 防止复制  
  5. 5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标  
  6. 6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标  
  7. 7.<input style="ime-mode:disabled"> 关闭输入法  
  8. 8. 永远都会带着框架  
  9. < script   language = "Javascript" > <!--  
  10. if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页  
  11. // --></script>  
  12.   
  13. 9. 防止被人frame  
  14. < script   LANGUAGE = JAVAscript > <!--   
  15. if (top.location != self.location)top.location=self.location;  
  16. // --></script>  
  17.   
  18. 10. <noscript><iframe src=*.html></iframe></noscript> 网页将不能被另存为  
  19.   
  20. 11. <input type=button value=查看网页源代码   
  21. onclick = "window.location = 'view-source:'+ 'http://www.csdn.net/'" >   
  22.   
  23. 12. 怎样通过asp的手段来检查来访者是否用了代理  
  24. < % if Request.ServerVariables("HTTP_X_FORWARDED_FOR") < > "" then  
  25. response.write "<font color=#FF0000>您通过了代理服务器,"& _  
  26. "真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")  
  27. end if  
  28. %>  
  29.   
  30. 13. 取得控件的绝对位置  
  31.   
  32. //Javascript  
  33. < script   language = "Javascript" >   
  34. function getIE(e){  
  35. var t=e.offsetTop;  
  36. var l=e.offsetLeft;  
  37. while(ee=e.offsetParent){  
  38. t+=e.offsetTop;  
  39. l+=e.offsetLeft;  
  40. }  
  41. alert("top="+t+"\nleft="+l);  
  42. }  
  43. </ script >   
  44.   
  45. //VBscript  
  46. < script   language = "VBscript" > <!--  
  47. function getIE()  
  48. dim t,l,a,b  
  49. set a=document.all.img1  
  50. t = document .all.img1.offsetTop  
  51. l = document .all.img1.offsetLeft  
  52. while a.tagName<>"BODY"  
  53. set aa = a.offsetParent  
  54. t t =t+a.offsetTop  
  55. l l =l+a.offsetLeft  
  56. wend  
  57. msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"  
  58. end function  
  59. --></script>  
  60.   
  61. 14. 光标是停在文本框文字的最后  
  62. < script   language = "javascript" >   
  63. function cc()  
  64. {  
  65. var e = event.srcElement;  
  66. var r =e.createTextRange();  
  67. r.moveStart('character',e.value.length);  
  68. r.collapse(true);  
  69. r.select();  
  70. }  
  71. </ script >   
  72. < input   type = text   name = text1   value = "123"   onfocus = "cc()" >   
  73.   
  74. 15. 判断上一页的来源  
  75. asp:  
  76. request.servervariables("HTTP_REFERER")  
  77.   
  78. javascript:  
  79. document.referrer  
  80.   
  81. 16. 最小化、最大化、关闭窗口  
  82. < object   id = hh1   classid = "clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11" >    
  83. < param   name = "Command"   value = "Minimize" > </ object >   
  84. < object   id = hh2   classid = "clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11" >    
  85. < param   name = "Command"   value = "Maximize" > </ object >   
  86. < OBJECT   id = hh3   classid = "clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >   
  87. < PARAM   NAME = "Command"   VALUE = "Close" > </ OBJECT >   
  88.   
  89. < input   type = button   value =最小化  onclick = hh1 .Click() >   
  90. < input   type = button   value =最大化  onclick = hh2 .Click() >   
  91. < input   type = button   value =关闭  onclick = hh3 .Click() >   
  92. 本例适用于IE  
  93.   
  94. 17.   
  95. < %  
  96. '定义数据库连接的一些常量  
  97. Const adOpenForwardOnly = 0 '游标只向前浏览记录,不支持分页、Recordset、BookMark  
  98. Const adOpenKeyset = 1 '键集游标,其他用户对记录说做的修改将反映到记录集中,但其他用户增加或删除记录不会反映到记录集中。支持分页、Recordset、BookMark  
  99. Const adOpenDynamic = 2 '动态游标功能最强,但耗资源也最多。用户对记录说做的修改,增加或删除记录都将反映到记录集中。支持全功能浏览(ACCESS不支持)。  
  100. Const adOpenStatic = 3 '静态游标,只是数据的一个快照,用户对记录说做的修改,增加或删除记录都不会反映到记录集中。支持向前或向后移动  
  101.   
  102. Const adLockReadOnly = 1 '锁定类型,默认的,只读,不能作任何修改  
  103. Const adLockPessimistic = 2 '当编辑时立即锁定记录,最安全的方式  
  104. Const adLockOptimistic = 3 '只有在调用Update方法时才锁定记录集,而在此前的其他操作仍可对当前记录进行更改、插入和删除等  
  105. Const adLockBatchOptimistic = 4 '当编辑时记录不会被锁定,而更改、插入和删除是在批处理方式下完成的  
  106.   
  107. Const adCmdText = &H0001  
  108. Const adCmdTable = &H0002  
  109. %>  
  110.   
  111. 18. 网页不会被缓存  
  112. HTM网页  
  113. < META   HTTP-EQUIV = "pragma"   CONTENT = "no-cache" >   
  114. < META   HTTP-EQUIV = "Cache-Control"   CONTENT = "no-cache, must-revalidate" >   
  115. < META   HTTP-EQUIV = "expires"   CONTENT = "Wed, 26 Feb 1997 08:21:57 GMT" >   
  116. 或者<META HTTP-EQUIV="expires" CONTENT="0">  
  117. ASP网页  
  118. Response.Expires  = -1  
  119. Response.ExpiresAbsolute  =  Now () - 1  
  120. Response.cachecontrol  =  "no-cache"   
  121. PHP网页  
  122. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");  
  123. header("Cache-Control: no-cache, must-revalidate");  
  124. header("Pragma: no-cache");  
  125.   
  126. 怎样让表单没有凹凸感?  
  127. < input   type = text   style = "border:1 solid #000000" >    
  128. 或  
  129. < input   type = text   style = "border-left:none; border-right:none; border-top:none; border-bottom: 1 solid #000000" > </ textarea >   
  130.   
  131. < div > < span > & < layer > 的区别?   
  132. < div > (division)用来定义大段的页面元素,会产生转行   
  133. < span > 用来定义同一行内的元素,跟 < div > 的唯一区别是不产生转行   
  134. < layer > 是ns的标记,ie不支持,相当于 < div >   
  135.   
  136. 让弹出窗口总是在最上面:  
  137. < body   onblur = "this.focus();" >   
  138.   
  139. 不要滚动条?   
  140. 让竖条没有:   
  141. < body   style = 'overflow:scroll;overflow-y:hidden' >    
  142. </ body >    
  143. 让横条没有:   
  144. < body   style = 'overflow:scroll;overflow-x:hidden' >    
  145. </ body >    
  146. 两个都去掉?更简单了   
  147. < body   scroll = "no" >    
  148. </ body >    
  149.   
  150. 怎样去掉图片链接点击后,图片周围的虚线?  
  151. < a   href = "#"   onFocus = "this.blur()" > < img   src = http ://www.chinaitpower.com/A/2005-01-22/"logo.jpg"  border = 0 > </ a >   
  152.   
  153. 电子邮件处理提交表单  
  154. < form   name = "form1"   method = "post"   action = "mailto:****@***.com"   enctype = "text/plain" >    
  155. < input   type = submit >   
  156. </ form >   
  157.   
  158. 在打开的子窗口刷新父窗口的代码里如何写?  
  159. window.opener.location.reload()  
  160.   
  161. 如何设定打开页面的大小  
  162. < body   onload = "top.resizeTo(300,200);" >   
  163.   
  164. 在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动   
  165. < html > < head >    
  166. < STYLE >    
  167. body   
  168. {background-image:url(logo.gif); background-repeat:no-repeat; background-position:center }   
  169. </ STYLE >    
  170. </ head >    
  171. < body   bgproperties = "fixed"   >    
  172. </ body >    
  173. </ html >    
  174.   
  175. 19. 检查一段字符串是否全由数字组成  
  176. < script   language = "Javascript" > <!--  
  177. function checkNum(str){return str.match(/\D/)==null}  
  178. alert(checkNum("1232142141"))  
  179. alert(checkNum("123214214a1"))  
  180. // --></script>  
  181.   
  182. 20. 获得一个窗口的大小  
  183. document.body.clientWidth,document.body.clientHeight  
  184.   
  185. 21. 怎么判断是否是字符  
  186. if (/[^\x00-\xff]/g.test(s)) alert("含有汉字");  
  187. else alert("全是字符");  
  188.   
  189. 22.TEXTAREA自适应文字行数的多少  
  190. < textarea   rows = 1   name = s1   cols = 27   onpropertychange = "this.style.posHeight=this.scrollHeight" >   
  191. </ textarea >   
  192.   
  193. 23. 日期减去天数等于第二个日期  
  194. < script   language = Javascript >   
  195. function cc(dd,dadd)  
  196. {  
  197. //可以加上错误处理  
  198. var a = new Date(dd)  
  199. a a  = a.valueOf()  
  200. a a  = a - dadd * 24 * 60 * 60 * 1000  
  201. a  =  new  Date(a)  
  202. alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")  
  203. }  
  204. cc("12/23/2002",2)  
  205. </ script >   
  206.   
  207. 24. 选择了哪一个Radio  
  208. < HTML > < script   language = "vbscript" >   
  209. function checkme()  
  210. for each ob in radio1  
  211. if ob.checked then window.alert ob.value  
  212. next  
  213. end function  
  214. </ script > < BODY >   
  215. < INPUT   name = "radio1"   type = "radio"   value = "style"  checked > Style  
  216. < INPUT   name = "radio1"   type = "radio"   value = "barcode" > Barcode  
  217. < INPUT   type = "button"   value = "check"   onclick = "checkme()" >   
  218. </ BODY > </ HTML >   
  219.   
  220. 25.获得本页url的request.servervariables("")集合  
  221. Response.Write "<TABLE border=1><!-- Table Header --><TR><TD><B>Variables</B></TD><TD><B>Value</B></TD></TR>"  
  222. for each ob in Request.ServerVariables  
  223. Response.Write "<TR><TD>"&ob&"</TD><TD>"&Request.ServerVariables(ob)&"</TD></TR>"  
  224. next  
  225. Response.Write "</TABLE>"  
  226.   
  227. 26.  
  228. 本机ip<%=request.servervariables("remote_addr")%>  
  229. 服务器名<%=Request.ServerVariables("SERVER_NAME")%>  
  230. 服务器IP<%=Request.ServerVariables("LOCAL_ADDR")%>  
  231. 服务器端口<%=Request.ServerVariables("SERVER_PORT")%>  
  232. 服务器时间<%=now%>  
  233. IIS版本<%=Request.ServerVariables"SERVER_SOFTWARE")%>  
  234. 脚本超时时间<%=Server.scriptTimeout%>  
  235. 本文件路径<%=server.mappath(Request.ServerVariables("script_NAME"))%>  
  236. 服务器CPU数量<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>  
  237. 服务器解译引擎<%=scriptEngine & "/"& scriptEngineMajorVersion &"."&scriptEngineMinorVersion&"."& scriptEngineBuildVersion %>  
  238. 服务器操作系统<%=Request.ServerVariables("OS")%>  
  239.   
  240. 27.ENTER键可以让光标移到下一个输入框  
  241. < input   onkeydown = "if(event.keyCode==13)event.keyCode=9" >   
  242.   
  243. 28. 检测某个网站的链接速度:  
  244. 把如下代码加入<body>区域中:  
  245. < script   language = Javascript >   
  246. tim = 1   
  247. setInterval("tim++",100)  
  248. b = 1   
  249.   
  250. var autourl=new Array()  
  251. autourl[1]="www.njcatv.net"  
  252. autourl[2]="javacool.3322.net"  
  253. autourl[3]="www.sina.com.cn"  
  254. autourl[4]="www.nuaa.edu.cn"  
  255. autourl[5]="www.cctv.com"  
  256.   
  257. function butt(){  
  258. document.write("<form name=autof>")  
  259. for(var i=1;i<autourl.length;i++)  
  260. document.write("<input type=text name=txt"+i+" size=10 value=测试中……> =》<input type=text name=url"+i+" size=40> =》<input type=button value=GO onclick=window.open(this.form.url"+i+".value)><br>")  
  261. document.write("<input type=submit value=刷新></form>")  
  262. }  
  263. butt()  
  264. function auto(url){  
  265. document.forms[0]["url"+b].value=url  
  266. if(tim>200)  
  267. {document.forms[0]["txt"+b].value="链接超时"}  
  268. else  
  269. {document.forms[0]["txt"+b].value="时间"+tim/10+"秒"}  
  270. b++  
  271. }  
  272. function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+"/"+Math.random()+" width=1 height=1 onerror=auto('http://";+autourl+"')>")}  
  273. run()</script>  
  274.   
  275. 29. 各种样式的光标  
  276. auto :标准光标  
  277. default :标准箭头  
  278. hand :手形光标  
  279. wait :等待光标  
  280. text :I形光标  
  281. vertical-text :水平I形光标  
  282. no-drop :不可拖动光标  
  283. not-allowed :无效光标  
  284. help :?帮助光标  
  285. all-scroll :三角方向标  
  286. move :移动标  
  287. crosshair :十字标  
  288. e-resize  
  289. n-resize  
  290. nw-resize  
  291. w-resize  
  292. s-resize  
  293. se-resize  
  294. sw-resize
  295. 原文地址:http://www.wujianrong.com/archives/2006/11/web_8.html
posted on 2007-01-15 10:33 cAng^Er 阅读(166) 评论(0)  编辑  收藏 所属分类: |:Web Design:|

只有注册用户登录后才能发表评论。


网站导航: