1. oncontextmenu="window.event.returnvalue=false" 将彻底屏蔽鼠标右键
\Pw8wayr% <table border oncontextmenu=return(false)><td>no</table> 可用于Table
8|w5QvCU?3 ZmEG<T05 2. <body onselectstart="return false"> 取消选取、防止复制
aSn0o_4bD zWF
5m )- 3. onpaste="return false" 不准粘贴
M3DxapG ?l6>6a7 4. oncopy="return false;" oncut="return false;" 防止复制
W2}%zux Py|H?
, 6= 5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标
g2+l@$W % MfGVx}nG 6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标
zkjPLeX a/`c ef 7. <input style="ime-mode:-Disabled"> 关闭输入法
4a(g<5wfI $w|o@ Ml) 8. 永远都会带着框架
[ea6dv4p <script language="javascript"><!--
UI|v/(_^F if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
^/_\etV // --></script>
gGtep*k y+K7WUwhq 9. 防止被人frame
#2_o[/&}x@ <SCRIPT LANGUAGE=javascript><!--
%00k1*$ if (top.location != self.location)top.location=self.location;
B'G*y2UnG // --></SCRIPT>
8C*6Fjb# vDu0 10. 网页将不能被另存为
/Nj:!!
AN <noscript><iframe src=*.html></iframe></noscript>
PphR4 sIM qT4I Y$h 11. <input type=button value=查看网页源代码
8gVxiFjo onclick="window.location = `view-source:`+
http://www.51js.com/`";>
J{nyo1A s=H/b$v 12.删除时确认
, aRJ!AZ <a href=`javascript:if(confirm("确实要删除吗?"location="boos.asp?&areyou=删除&page=1"`>删
}XfS#Xr1aV ,^MW)Gf< 除</a>
*=-__|t rK(x4]I
l" 13. 取得控件的绝对位置
2+T 8Y,g //javascript
s,UN'~e1 <script language="javascript">
&+E'1h10 function getIE(E){
GW>7R6i var t=e.offsetTop;
|QAeQWP+1 var l=e.offsetLeft;
4
|:Q1 while(e=e.offsetParent){
$I}Hk^X t+=e.offsetTop;
9#Aipu\ l+=e.offsetLeft;
^D W# }
.LXh]I* alert("top="+t+"/nleft="+l);
mV:RmA }
?)Czl4J </script>
yNhscAMNn Y{Y;EY4 //VBScript
+E q~X=x <script language="VBScript"><!--
PBxK>a function getIE()
~uhyROO,G" dim t,l,a,b
Ckl7rpY+ set a=document.all.img1
[6,]9|~ t=document.all.img1.offsetTop
H0D>A<Ue l=document.all.img1.offsetLeft
X] JpS while a.tagName<>"BODY"
YA^wUx set a = a.offsetParent
qrkRD*a t=t+a.offsetTop
\J,- <wF l=l+a.offsetLeft
Ac5o K wend
w+).pcG(* msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
m'Ek p end function
o-Q]Dk1W
--></script>
-CU7u=*b zulf%aaL 14. 光标是停在文本框文字的最后
)MD*)O <script language="javascript">
lry&)G=5 function cc()
DK@w^ZW6JA {
}QWTPRn var e = event.srcElement;
hdsgOu var r =e.createTextRange();
=& Tu`m r.moveStart(`character`,e.value.length);
aiR|.opIb r.collapse(true);
sO{0hZkc r.select();
-KIVnV=&m }
7?Qt2tr </script>
5|6z1{g8 <input type=text name=text1 value="123" onfocus="cc()">
aV?}+Y{# I7q?V1fu4 15. 判断上一页的来源
g6@N PQ javascript:
Eis%)oE
document.referrer
/8$1[[[ \[IdR^<YM 16. 最小化、最大化、关闭窗口
j;AzkReb <object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
S0Bl?XsD_ <param name="Command" value="Minimize"></object>
Z+``/Q]>+ <object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
!0. 5 <param name="Command" value="Maximize"></object>
3h D2C'KD <OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
#>=/15: <PARAM NAME="Command" value="Close"></OBJECT>
qh)!| B ^+-L;XkeY <input type=button value=最小化 onclick=hh1.Click()>
S,"ChR <input type=button value=最大化 onclick=hh2.Click()>
2=Y_Qrhi <input type=button value=关闭 onclick=hh3.Click()>
St3(1mApl 本例适用于IE
F;MT4*4 6t7;}t]t 17.屏蔽功能键Shift,Alt,Ctrl
8Snq75Q< <script>
ZB^4 (F')H function look(){
#o r7T^ if(event.shiftKey)
,$6MM6W;-F alert("禁止按Shift键!"; //可以换成ALT CTRL
,
R.+-X }
Z'>eT) document.onkeydown=look;
/_k hFw </script>
M;p q2$ %B {D 18. 网页不会被缓存
ZTBFV/{ <META HTTP-EQUIV="pragma" CONTENT="no-cache">
^zWO[$n}tP <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
/qkIoF2 <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
#Lxj
) 或者<META HTTP-EQUIV="expires" CONTENT="0">
!{]v='
k,NU,^ & 19.怎样让表单没有凹凸感?
2GD mZl <input type=text style="border:1 solid #000000">
bF Y)o Z 或
602eLV) <input type=text style="border-left:none; border-right:none; border-top:none; border-bottom:
<0Egkz3s ANpY qV 1 solid #000000"></textarea>
SVs~, GaK_9Eg-2 20.<div><span>&<layer>的区别?
KEVy%AP=*h <div>(division)用来定义大段的页面元素,会产生转行
9}qfdbI <span>用来定义同一行内的元素,跟<div>的唯一区别是不产生转行
?9r,Y;,H <layer>是ns的标记,ie不支持,相当于<div>
z7Rcnr; a4a[pX,5 21.让弹出窗口总是在最上面:
q/2K=BOh <body onblur="this.focus();">
DHumBnQ |b'<XQ&l5 22.不要滚动条?
iB`WXU 让竖条没有:
'3_B1iAv <body style=`overflow:-Scroll;overflow-y:hidden`>
u FYQ^ </body>
]BQWA 让横条没有:
I`$I0 <body style=`overflow:-Scroll;overflow-x:hidden`>
*~<]|H5~ </body>
|3T|F3uEX
两个都去掉?更简单了
~
%YTJS <body scroll="no">
MoR-8vnJ </body>
s8_NN GwpBDMk 23.怎样去掉图片链接点击后,图片周围的虚线?
Y %D*O <a href="#" onFocus="this.blur()"><img src="logo.jpg" border=0></a>
teS0F DdS3<3]A 24.电子邮件处理提交表单
y[@j0xlO <form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain">
+i_f.Ipp <input type=submit>
NF\^'W@N </form>
|XdrO 10I`AjF0 25.在打开的子窗口刷新父窗口的代码里如何写?
; 7v7V window.opener.location.reload()
D%Jc?6/I#3 [[r3fEr$!p 26.如何设定打开页面的大小
F-7b`cF9[r <body onload="top.resizeTo(300,200);">
"T1#*"{j 打开页面的位置<body onload="top.moveBy(300,200);">
R6@~ _DvPF~ 27.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动
<