时间: 2021-07-31 作者:daque
1. oncontextmenu="window.event.returnvalue=false" 将完全樊篱鼠标右键<table border oncontextmenu=return(false)><td>no</table> 可用来table
2. <body onselectstart="return false"> 废除采用、提防复制3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return false;" 提防复制
5. <link rel="shortcut icon" href="favicon.ico"> ie地方栏前换成本人的图标
6. <link rel="bookmark" href="favicon.ico"> 不妨在保藏夹中表露出你的图标
7. <input style="ime-mode:disabled"> 封闭输出法
8. 长久城市带着框架<script language="javascript"><!--if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页// --></script>
9. 提防被人frame<script language=javascript><!-- if (top.location != self.location)top.location=self.location;// --></script>
10. 网页将不许被另存为<noscript><iframe src=*.html></iframe></noscript>
11. <input type=button value=察看网页源代码 onclick="window.location = "view-source:"+ "http://www.pconline.com.cn"">
12.简略时确认<a href="javascript:if(confirm("真实要简略吗?"))location="boos.asp?&areyou=简略&page=1"">简略</a>
13. 博得控件的一致场所//javascript<script language="javascript">function getie(e){var t=e.offsettop;var l=e.offsetleft;while(e=e.offsetparent){t+=e.offsettop;l+=e.offsetleft;}alert("top="+t+"/nleft="+l);}</script>
//vbscript<script language="vbscript"><!--function getie()dim t,l,a,bset a=document.all.img1t=document.all.img1.offsettopl=document.all.img1.offsetleftwhile a.tagname<>"body"set a = a.offsetparentt=t+a.offsettopl=l+a.offsetleftwendmsgbox "top="&t&chr(13)&"left="&l,64,"获得控件的场所"end function--></script>
[page_break]14. 光标是停在文本框笔墨的结果<script language="javascript">function cc(){var e = event.srcelement;var r =e.createtextrange();r.movestart("character",e.value.length);r.collapse(true);r.select();}</script><input type=text name=text1 value="123" onfocus="cc()">
15. 确定上一页的根源javascript:document.referrer
16. 最小化、最大化、封闭窗口<object id=hh1 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <param name="command" value="minimize"></object><object id=hh2 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <param name="command" value="maximize"></object><object id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><param name="command" value="close"></object><input type=button value=最小化 onclick=hh1.click()><input type=button value=最大化 onclick=hh2.click()><input type=button value=封闭 onclick=hh3.click()>本例实用于ie
17.樊篱功效键shift,alt,ctrl<script>function look(){ if(event.shiftkey) alert("遏止按shift键!"); //不妨换成alt ctrl} document.onkeydown=look; </script>
18. 网页不会被缓存<meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache, must-revalidate"><meta http-equiv="expires" content="wed, 26 feb 1997 08:21:57 gmt">大概<meta http-equiv="expires" content="0">
19.还好吗让表单没有坎坷感?<input type=text style="border:1 solid #000000"> 或<input type=text style="border-left:none; border-right:none; border-top:none; border-bottom:
1 solid #000000"></textarea>
20.<div><span>&<layer>的辨别? <div>(division)用来设置大段的页面元素,会爆发转行 <span>用来设置同一条龙内的元素,跟<div>的独一辨别是不爆发转行 <layer>是ns的标志,ie不扶助,十分于<div>
21.让弹出窗口老是在最上头:<body onblur="this.focus();">
22.不要震动条? 让竖条没有: <body style="overflow:scroll;overflow-y:hidden"> </body> 让横条没有: <body style="overflow:scroll;overflow-x:hidden"> </body> 两个都去掉?更大略了 <body scroll="no"> </body>
23.还好吗去掉图片链接点击后,图片范围的虚线?<a href="#" onfocus="this.blur()"><img src="http://edu.chinaz.com/get/website/javascript/logo.jpg" border=0></a>
24.电子邮件处置提交表单<form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain"> <input type=submit></form>
25.在翻开的子窗口革新父窗口的代码里怎样写?window.opener.location.reload()
[page_break]26.怎样设定翻开页面包车型的士巨细<body onload="top.resizeto(300,200);">翻开页面包车型的士场所<body onload="top.moveby(300,200);">
27.在页面中怎样介入不是满铺的后台图片,拉动页面时后台图不动 <style> body {background-image:url(logo.gif); background-repeat:no-repeat; background-position:center;background-attachment: fixed} </style>
28. 查看一段字符串能否全由数字构成<script language="javascript"><!--function checknum(str){return str.match(//d/)==null}alert(checknum("1232142141"))alert(checknum("123214214a1"))// --></script>
29. 赢得一个窗口的巨细document.body.clientwidth; document.body.clientheight
30. 如何确定能否是字符if (/[^/x00-/xff]/g.test(s)) alert("含有中国字");else alert("全是字符");
31.textarea自符合笔墨行数的几何<textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posheight=this.scrollheight"></textarea>
32. 日子减去天数即是第二个日子<script language=javascript>function cc(dd,dadd){//不妨加上缺点处置var a = new date(dd)a = a.valueof()a = a - dadd * 24 * 60 * 60 * 1000a = new date(a)alert(a.getfullyear() + "年" + (a.getmonth() + 1) + "月" + a.getdate() + "日")}cc("12/23/2002",2)</script>
33. 采用了哪一个radio<html><script language="vbscript">function checkme()for each ob in radio1if ob.checked then window.alert ob.valuenextend function</script><body><input name="radio1" type="radio" value="style" checked>style<input name="radio1" type="radio" value="barcode">barcode<input type="button" value="check" onclick="checkme()"></body></html>
34.剧本永不堕落<script language="javascript"> <!-- hide function killerrors() { return true; } window.onerror = killerrors; // --> </script>
35.enter键不妨让光标移到下一个输出框<input onkeydown="if(event.keycode==13)event.keycode=9">
[page_break]36. 检验和测定某个网站的链接速率:把如次代码介入<body>地区中:<script language=javascript>tim=1setinterval("tim++",100)b=1var autourl=new array()autourl[1]="www.njcatv.net"autourl[2]="javacool.3322.net"autourl[3]="www.sina.com.cn"autourl[4]="www.nuaa.edu.cn"autourl[5]="www.cctv.com"function butt(){document.write("<form name=autof>")for(var i=1;i<autourl.length;i++)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>")document.write("<input type=submit value=革新></form>")}butt()function auto(url){document.forms[0]["url"+b].value=urlif(tim>200){document.forms[0]["txt"+b].value="链接超时"}else{document.forms[0]["txt"+b].value="功夫"+tim/10+"秒"}b++}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+"")>")}run()</script>
37. 百般款式的光标auto :规范光标default :规范箭镞hand :手形光标wait :等候光标text :i形光标vertical-text :程度i形光标no-drop :不行拖动光标not-allowed :失效光标help :?扶助光标all-scroll :三角目标标move :挪动标crosshair :十字标e-resizen-resizenw-resizew-resizes-resizese-resizesw-resize
[page_break]38.页面加入和退出的殊效加入页面<meta http-equiv="page-enter" content="revealtrans(duration=x, transition=y)">推出页面<meta http-equiv="page-exit" content="revealtrans(duration=x, transition=y)"> 这个是页面被载入和调出时的少许殊效。duration表白殊效的连接功夫,以秒为单元。transition表白运用哪种殊效,取值为1-23: 0 矩形减少 1 矩形夸大 2 圆形减少 3 圆形夸大 4 下到上革新 5 上到下革新 6 左到右革新 7 右到左革新 8 竖吊窗 9 横吊窗 10 错位横吊窗 11 错位竖吊窗 12 点分散 13 安排到中央革新 14 中央到安排革新 15 中央到左右 16 左右到中央 17 右下到左上 18 右上到左下 19 左上到右下 20 左下到右上 21 横条 22 竖条 23 之上22种随机采用一种
39.在规则功夫内跳转<meta http-equiv=v="refresh" content="5;url=http://www.51js.com">
40.网页能否被检索<meta name="robots" content="属性值"> 个中属性值有以次少许: 属性值为"all": 文献将被检索,且页上链接可被查问; 属性值为"none": 文献不被检索,并且不查问页上的链接; 属性值为"index": 文献将被检索; 属性值为"follow": 查问页上的链接; 属性值为"noindex": 文献不检索,但可被查问链接; 属性值为"nofollow": 文献不被检索,但可查问页上的链接。