2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return false;" 防止复制
5. <link rel="Shortcut Icon" href="favicon.ico">
[3'@ IE地址栏前换成自己的图标
6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标
[3'@
7. <input style="ime-modeisabled"> 关闭输入法
8. 永远都会带着框架
[3'@ <script language="javascript"><!--
[3'@ if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
[3'@
[3'@ // --></script>
9. 防止被人frame
[3'@ <SCRIPT LANGUAGE=javascript><!--
[3'@ if (top.location != self.location)top.location=self.location;
[3'@ // --></SCRIPT>
10. <noscript><iframe src=*.html></iframe></noscript>
[3'@ 网页将不能被另存为
11. <input type=button &#118alue=查看网页源代码
[3'@ &#111nclick="window.location = 'view-source:'+ 'http://www.csdn.net/&#39;">
[3'@
12. 怎样通过asp的手段来检查来访者是否用了代理
[3'@ <% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>""
[3'@ then
[3'@ response.write "<font color=#FF0000>您通过了代理服务器,"& _
[3'@ "真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
[3'@
[3'@ end if
[3'@ %>
13. 取得控件的绝对位置
//javascript
[3'@ <script language="javascript">
[3'@ function getIE(e){
[3'@ var t=e.offsetTop;
[3'@ var l=e.offsetLeft;
[3'@ while(e=e.offsetParent){
[3'@ t+=e.offsetTop;
[3'@ l+=e.offsetLeft;
[3'@ }
[3'@ alert("top="+t+"\nleft="+l);
[3'@ }
[3'@ </script>
//VBScript
[3'@ <script language="VBScript"><!--
[3'@ function getIE()
[3'@ dim t,l,a,b
[3'@ set a=document.all.img1
[3'@ t=document.all.img1.offsetTop
[3'@ l=document.all.img1.offsetLeft
[3'@ while a.tagName<>"BODY"
[3'@ set a = a.offsetParent
[3'@ t=t+a.offsetTop
[3'@ l=l+a.offsetLeft
[3'@ wend
[3'@ msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
[3'@
[3'@ end function
[3'@ --></script>
14. 光标是停在文本框文字的最后
[3'@ <script language="javascript">
[3'@ function cc()
[3'@ {
[3'@ var e = event.srcElement;
[3'@ var r =e.createTextRange();
[3'@ r.moveStart('character',e.&#118alue.length);
[3'@ r.collapse(true);
[3'@ r.select();
[3'@ }
[3'@ </script>
[3'@ <input type=text name=text1 &#118alue="123" onfocus="cc()">
[3'@
15. 判断上一页的来源
[3'@ asp:
[3'@ request.servervariables("HTTP_REFERER")
java script:
[3'@ document.referrer
16. 最小化、最大化、关闭窗口
[3'@ <object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
[3'@
[3'@ <param name="Command" &#118alue="Minimize"></object>
[3'@
[3'@ <object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
[3'@
[3'@ <param name="Command" &#118alue="Maximize"></object>
[3'@
[3'@ <OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
[3'@
[3'@ <PARAM NAME="Command" &#118alue="Close"></OBJECT>
[3'@
<input type=button &#118alue=最小化 &#111nclick=hh1.Click()>
[3'@ <input type=button &#118alue=最大化 &#111nclick=hh2.Click()>
[3'@ <input type=button &#118alue=关闭 &#111nclick=hh3.Click()>
[3'@ 本例适用于IE
17.
[3'@ <%
[3'@ '定义数据库连接的一些常量
[3'@ Const adOpenForwardOnly = 0 '游标只向前浏览记录,不支持分页、Recordset、BookMark
[3'@ Const adOpenKeyset = 1 '键集游标,其他用户对记录说做的修改将反映到记录集中,但其他用户增加或删除记录不会反映到记录集中。支持分页、Recordset、BookMark
[3'@
[3'@ Const adOpenDynamic = 2 '动态游标功能最强,但耗资源也最多。用户对记录说做的修改,增加或删除记录都将反映到记录集中。支持全功能浏览(ACCESS不支持)。
[3'@
[3'@ Const adOpenStatic = 3 '静态游标,只是数据的一个快照,用户对记录说做的修改,增加或删除记录都不会反映到记录集中。支持向前或向后移动
[3'@
Const adLockReadOnly = 1 '锁定类型,默认的,只读,不能作任何修改
[3'@ Const adLockPessimistic = 2 '当编辑时立即锁定记录,最安全的方式
[3'@ Const adLockOptimistic = 3 '只有在调用Update方法时才锁定记录集,而在此前的其他操作仍可对当前记录进行更改、插入和删除等
[3'@
[3'@ Const adLockBatchOptimistic = 4 '当编辑时记录不会被锁定,而更改、插入和删除是在批处理方式下完成的
Const adCmdText = &H0001
[3'@ Const adCmdTable = &H0002
[3'@ %>
18. 网页不会被缓存
[3'@ HTM网页
[3'@ <META HTTP-EQUIV="pragma" CONTENT="no-cache">
[3'@ <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
[3'@
[3'@ <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57
[3'@ GMT">
[3'@ 或者<META HTTP-EQUIV="expires" CONTENT="0">
[3'@ ASP网页
[3'@ Response.Expires = -1
[3'@ Response.ExpiresAbsolute = Now() - 1
[3'@ Response.cachecontrol = "no-cache"
[3'@ PHP网页
[3'@ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
[3'@ header("Cache-Control: no-cache, must-revalidate");
[3'@ header("Pragma: no-cache");
怎样让表单没有凹凸感?
[3'@ <input type=text style="border:1 solid #000000">
[3'@ 或
[3'@ <input type=text style="border-left:none; border-right:none; border-top:none;
[3'@ border-bottom: 1 solid #000000"></textarea>
<div><span>&<layer>的区别?
[3'@ <div>(division)用来定义大段的页面元素,会产生转行
[3'@ <span>用来定义同一行内的元素,跟<div>的唯一区别是不产生转行
[3'@ <layer>是ns的标记,ie不支持,相当于<div>
[3'@ 让弹出窗口总是在最上面:
[3'@ <body onblur="this.focus();">
不要滚动条?
[3'@ 让竖条没有:
[3'@ <body style='overflowcroll;overflow-y:hidden'>
[3'@ </body>
[3'@ 让横条没有:
[3'@ <body style='overflowcroll;overflow-x:hidden'>
[3'@ </body>
[3'@ 两个都去掉?更简单了
[3'@ <body scroll="no">
[3'@ </body>
怎样去掉图片链接点击后,图片周围的虚线?
[3'@ <a href="#" onFocus="this.blur()"><img src="logo.jpg"
[3'@ border=0></a>
电子邮件处理提交表单
[3'@ <form name="form1" method="post" action="mailto:****@***.com"
[3'@ enctype="text/plain">
[3'@ <input type=submit>
[3'@ </form>
在打开的子窗口刷新父窗口的代码里如何写?
[3'@ window.opener.location.reload()
如何设定打开页面的大小
[3'@ <body onload="top.resizeTo(300,200);">
在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动
[3'@ <html><head>
[3'@ <STYLE>
[3'@ body
[3'@ {background-image:url(logo.gif); background-repeat:no-repeat; background-position:center
[3'@ }
[3'@ </STYLE>
[3'@ </head>
[3'@ <body bgproperties="fixed" >
[3'@ </body>
[3'@ </html>
19. 检查一段字符串是否全由数字组成
[3'@ <script language="javascript"><!--
[3'@ function checkNum(str){return str.match(/\D/)==null}
[3'@ alert(checkNum("1232142141"))
[3'@ alert(checkNum("123214214a1"))
[3'@ // --></script>
20. 获得一个窗口的大小
[3'@ document.body.clientWidth,document.body.clientHeight
21. 怎么判断是否是字符
[3'@ if (/[^\x00-\xff]/g.test(s)) alert("含有汉字");
[3'@ else alert("全是字符");
22.TEXTAREA自适应文字行数的多少
[3'@ <textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">
[3'@
[3'@ </textarea>
23. 日期减去天数等于第二个日期
[3'@ <script language=javascript>
[3'@ function cc(dd,dadd)
[3'@ {
[3'@ //可以加上错误处理
[3'@ var a = new Date(dd)
[3'@ a = a.&#118alueOf()
[3'@ a = a - dadd * 24 * 60 * 60 * 1000
[3'@ a = new Date(a)
[3'@ alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" +
[3'@ a.getDate() + "日")
[3'@ }
[3'@ cc("12/23/2002",2)
[3'@ </script>
24. 选择了哪一个Radio
[3'@ <HTML><script language="vbscript">
[3'@ function checkme()
[3'@ for each ob in radio1
[3'@ if ob.checked then window.alert ob.&#118alue
[3'@ next
[3'@ end function
[3'@ </script><BODY>
[3'@ <INPUT name="radio1" type="radio" &#118alue="style"
[3'@ checked>Style
[3'@ <INPUT name="radio1" type="radio" &#118alue="barcode">Barcode
[3'@
[3'@ <INPUT type="button" &#118alue="check" &#111nclick="checkme()">
[3'@
[3'@ </BODY></HTML>
25.获得本页url的request.servervariables("")集合
[3'@ Response.Write "<TABLE border=1><!-- Table Header --><TR><TD><B>Variables</B></TD><TD><B>&#118alue</B></TD></TR>"
[3'@
[3'@ for each ob in Request.ServerVariables
[3'@ Response.Write "<TR><TD>"&ob&"</TD><TD>"&Request.ServerVariables(ob)&"</TD></TR>"
[3'@
[3'@ next
[3'@ Response.Write "</TABLE>"
26.
[3'@ 本机ip<%=request.servervariables("remote_addr")%>
[3'@ 服务器名<%=Request.ServerVariables("SERVER_NAME")%>
[3'@ 服务器IP<%=Request.ServerVariables("LOCAL_ADDR")%>
[3'@ 服务器端口<%=Request.ServerVariables("SERVER_PORT")%>
[3'@ 服务器时间<%=now%>
[3'@ IIS版本<%=Request.ServerVariables"SERVER_SOFTWARE")%>
[3'@ 脚本超时时间<%=Server.ScriptTimeout%>
[3'@ 本文件路径<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%>
[3'@
[3'@ 服务器CPU数量<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>
[3'@
[3'@ 服务器解译引擎<%=ScriptEngine & "/"& ScriptEngineMajorVersion
[3'@ &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion
[3'@ %>
[3'@ 服务器操作系统<%=Request.ServerVariables("OS")%>
27.ENTER键可以让光标移到下一个输入框
[3'@ <input &#111nkeydown="if(event.keyCode==13)event.keyCode=9">
28. 检测某个网站的链接速度:
[3'@ 把如下代码加入<body>区域中:
[3'@ <script language=javascript>
[3'@ tim=1
[3'@ setInterval("tim++",100)
[3'@ b=1
var autourl=new Array()
[3'@ autourl[1]="www.njcatv.net"
[3'@ autourl[2]="javacool.3322.net"
[3'@ autourl[3]="www.sina.com.cn"
[3'@ autourl[4]="www.nuaa.edu.cn"
[3'@ autourl[5]="www.cctv.com"
function butt(){
[3'@ document.write("<form name=autof>")
[3'@ for(var i=1;i<autourl.length;i++)
[3'@ document.write("<input type=text name=txt"+i+" size=10 &#118alue=测试中……>
[3'@ =》<input type=text name=url"+i+" size=40> =》<input type=button
[3'@ &#118alue=GO &#111nclick=window.open(this.form.url"+i+".&#118alue)>
[3'@")
[3'@
[3'@ document.write("<input type=submit &#118alue=刷新></form>")
[3'@
[3'@ }
[3'@ butt()
[3'@ function auto(url){
[3'@ document.forms[0]["url"+b].&#118alue=url
[3'@ if(tim>200)
[3'@ {document.forms[0]["txt"+b].&#118alue="链接超时"}
[3'@ else
[3'@ {document.forms[0]["txt"+b].&#118alue="时间"+tim/10+"秒"}
[3'@
[3'@ b++
[3'@ }
[3'@ function run(){for(var i=1;i<autourl.length;i++)document.write("<img
[3'@ src=http://"+autourl[I+"/"+Math.random()+" width=1 height=1
[3'@ &#111nerror=auto('http://";+autourl[I+"')>")}
[3'@ run()</script>
29. 各种样式的光标
[3'@ auto :标准光标
[3'@ default :标准箭头
[3'@ hand :手形光标
[3'@ wait :等待光标
[3'@ text :I形光标
[3'@ vertical-text :水平I形光标
[3'@ no-drop :不可拖动光标
[3'@ not-allowed :无效光标
[3'@ help :?帮助光标
[3'@ all-scroll :三角方向标
[3'@ move :移动标
[3'@ crosshair :十字标
[3'@ e-resize
[3'@ n-resize
[3'@ nw-resize
[3'@ w-resize
[3'@ s-resize
[3'@ se-resize
[3'@ sw-resize