一些常用的网页特效2.<bodyonselectstart=returnfalse>取消选取、防止复制3.onpaste=returnfalse不准粘贴4.oncopy=returnfalse;oncut=returnfalse;防止复制5.<linkrel=ShortcutIconhref=favicon.ico>IE地址栏前换成自己的图标6.<linkrel=Bookmarkhref=favicon.ico>可以在收藏夹中显示出你的图标7.<inputstyle=ime-mode:disabled>关闭输入法8.永远都会带着框架<scriptlanguage=JavaScript><!--if(window==top)top.location.href=frames.htm;//frames.htm为框架网页//--></script>9.防止被人frame<SCRIPTLANGUAGE=JAVASCRIPT><!--if(top.location!=self.location)top.location=self.location;//--></SCRIPT>10.网页将不能被另存为<noscript><iframesrc=/*.html>;</iframe></noscript>11.<inputtype=buttonvalue=查看网页源代码onclick=window.location=view-source:+删除时确认<ahref=javascript:if(confirm(确实要删除吗?))location=boos.asp?&areyou=删除&page=1>删除</a>13.取得控件的绝对位置//Javascript<scriptlanguage=Javascript>functiongetIE(e){vart=e.offsetTop;varl=e.offsetLeft;while(e=e.offsetParent){t+=e.offsetTop;l+=e.offsetLeft;}alert(top=+t+/nleft=+l);}</script>//VBScript<scriptlanguage=VBScript><!--functiongetIE()dimt,l,a,bseta=document.all.img1t=document.all.img1.offsetTopl=document.all.img1.offsetLeftwhilea.tagName<>BODYseta=a.offsetParentt=t+a.offsetTopl=l+a.offsetLeftwendmsgboxtop=&t&chr(13)&left=&l,64,得到控件的位置endfunction--></script>14.光标是停在文本框文字的最后<scriptlanguage=javascript>functioncc(){vare=event.srcElement;varr=e.createTextRange();r.moveStart(character,e.value.length);r.collapse(true);r.select();}</script><inputtype=textname=text1value=123onfocus=cc()>15.判断上一页的来源javascript:document.referrer16.最小化、最大化、关闭窗口<objectid=hh1classid=clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11><paramname=Commandvalue=Minimize></object><objectid=hh2classid=clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11><paramname=Commandvalue=Maximize></object><OBJECTid=hh3classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11><PARAMNAME=CommandVALUE=Close></OBJECT><inputtype=buttonvalue=最小化onclick=hh1.Click()><inputtype=buttonvalue=最大化onclick=hh2.Click()><inputtype=buttonvalue=关闭onclick=hh3.Click()>本例适用于IE17.屏蔽功能键Shift,Alt,Ctrl<script>functionlook(){if(event.shiftKey)alert(禁止按Shift键!);//可以换成ALTCTRL}document.onkeydown=look;</script>18.网页不会被缓存<METAHTTP-EQUIV=pragmaCONTENT=no-cache><METAHTTP-EQUIV=Cache-ControlCONTENT=no-cache,must-revalidate><METAHTTP-EQUIV=expiresCONTENT=Wed,26Feb199708:21:57GMT>或者<METAHTTP-EQUIV=expiresCONTENT=0>19.怎样让表单没有凹凸感?<inputtype=textstyle=border:1solid#000000>或<inputtype=textstyle=border-left:none;border-right:none;border-top:none;border-bottom:1solid#000000></textarea>20.<div><span>&<layer>的区别?<div>(division)用来定义大段的页面元素,会产生转行<span>用来定义同一行内的元素,跟<div>的唯一区别是不产生转行<layer>是ns的标记,ie不支持,相当于<div>21.让弹出窗口总是在最上面:<bodyonblur=this.focus();>22.不要滚动条?让竖条没有:<bodystyle=overflow:scroll;overflow-y:hidden></body>让横条没有:<bodystyle=overflow:scroll;overflow-x:hidden></body>两个都去掉?更简单了<bodyscroll=no></body>23.怎样去掉图片链接点击后,图片周围的虚线?<ahref=#onFocus=this.blur()><imgsrc=/logo.jpgborder=0></a>24.电子邮件处理提交表单<formname=form1method=postaction=mailto:****@***.comenctype=text/plain><inputtype=submit></form>25.在打开的子窗口刷新父窗口的代码里如何写?window.opener.location.reload()26.如何设定打开页面的大小<bodyonload=top.resizeTo(300,200);>打开页面的位置<bodyonload=top.moveBy(300,200);>27.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动<STYLE>body{background-image:url(/logo.gif);background-repeat:no-repeat;background-position:center;background-attachment:fixed}</STYLE>28.检查一段字符串是否全由数字组成<scriptlanguage=Javascript><!--functioncheckNum(str){returnstr.match(//D/)==null}alert(checkNum(1232142141))alert(checkNum(123214214a1))//--></script>29.获得一个窗口的大小document.body.clientWidth;document.body.clientHeight30.怎么判断是否是字符if(/[^/x00-/xff]/g.test(s))alert(含有汉字);elsealert(全是字符);31.TEXTAREA自适应文字行数的多少<textarearows=1name=s1cols=27onpropertychange=this.style.posHeight=this.scrollHeight></textarea>32.日期减去天数等于第二个日期<scriptlanguage=Javascript>functioncc(dd,dadd){//可以加上错误处理vara=newDate(dd)a=a.valueOf()a=a-dadd*24*60*60*1000a=newDate(a)alert(a.getFullYear()+年+(a.getMonth()+1)+月+a.getDate()+日)}cc(12/23/2002,2)</script>33.选择了哪一个Radio<HTML><scriptlanguage=vbscript>functioncheckme()foreachobinradio1ifob.checkedthenwindow.alertob.valuenextendfunction</script><BODY><INPUTname=radio1type=radiovalue=stylechecked>Style<INPUTname=radio1type=radiovalue=barcode>Barcode<INPUTtype=buttonvalue=checkonclick=checkme()></BODY></HTML>34.脚本永不出错<SCRIPTLANGUAGE=JavaScript><!--HidefunctionkillErrors(){returntrue;}window.onerror=killErrors;//--></SCRIPT>35.ENTER键可以让光标移到下一个输入框<inputonkeydown=if(event.keyCode==13)event.keyCode=9>36.检测某个网站的链接速度:把如下代码加入&l