JavaScript²¶»ñ´°¿Ú¹Ø±Õʼþ
JavaScript²¶»ñ´°¿Ú¹Ø±Õʼþ
¹Ø¼ü×Ö: window.closeʼþ
javascript²¶»ñ´°¿Ú¹Ø±ÕʼþÓÐÁ½ÖÖ·½·¨
1.ÓÃjavascriptÖØж¨Òå window.onbeforeunload() ʼþ
ÔÚjavascriptÀﶨÒåÒ»¸öº¯Êý¼´¿É
function window.onbeforeunload() { alert("¹Ø±Õ´°¿Ú")}
alert()ʼþ½«»áÔڹرմ°¿ÚÇ°Ö´ÐУ¬ÄãÒ²¿ÉÒÔÓû§¾ö¶¨ÊÇ·ñ¹Ø±Õ´°¿Ú
function window.onbeforeunload() {
if (event.clientX>document.body.clientWidth && event.clientY<0 ||event.altKey)
window.event.returnValue="È·¶¨ÒªÍ˳ö±¾Ò³Âð£¿";
}
2.ÓÃonUnload·½·¨
ÔÚbody ±êÇ©Àï¼ÓÈëonUnloadʼþ
body onUnload="myClose()"
È»ºóÔÚjavascriptÀﶨÒåmyClose()·½·¨
µ«ÊÇonUnload·½·¨ÊÇÔڹرմ°¿ÚÖ®ºóÖ´ÐУ¬²»ÊÇÔڹرմ°¿Ú֮ǰִÐУ¬Èç¹ûÄãÏëÔڹرմ°¿Ú֮ǰ×öÅжϣ¬ÇëÓõÚÒ»ÖÖ·½·¨
Ïà¹ØÎĵµ£º
Òý×Ó
±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂƵľÀ²øÖгÊÏÖ³öÎÞÏÞµÄÉú»úºÍ»îÁ¦¡£
Êý¾ÝÌìÉú¾ÍÊÇÎľ²µÄ£¬×ÜÏë±£³Ö×Ô¼º¹ÌÓеı¾É«£»¶ø´úÂëÈ´ÌìÉú»îÆã¬×ÜÏë¸Ä±äÕâ¸öÊÀ½ç¡£
Äã¿´£¬Êý¾Ý´úÂë¼äµÄ¹ØϵÓëÎï ......
×ÖĸºÍÊý×Ö¼üµÄ¼üÂëÖµ(keyCode)
°´¼ü
¼üÂë
°´¼ü
¼üÂë
°´¼ü
¼üÂë
°´¼ü
¼üÂë
A
65
J
74
S
83
1
49
B
66
K
75
T
84
2
50
C
67
L
76
U
85
3
51
D
68
M
77
V
86
4
52
E
69
N
78
W
87
5
53
F
70
O
79
X
88
6
54
G
71
P
80
Y
89
7
55
H
72
Q
81
Z
90
8
......
// PageLoadʼþ
var onloadMethod = window.onload;
window.onload = window_Load;
function window_Load() {
var i;
var item;
// È«²¿Á¬½ÓµÄʼþ
for (i = 0; i < document.links.length; i ++) {
item = document.links[i]
Object.Aspect.around(item, "onclick", checkLoading);
}
// È«²¿°´Å ......
×Û¹ÛÒ»¸öϵͳµÄ·¢Õ¹£¬ÎÞ·ÇÊÇ·¢ÏÖÒ»¸öÎÊÌâ¾Í°ÑËü¶ÀÁ¢³öÀ´½â¾öµô£¬Òò´ËËüµÄËùÓÐÄ£¿é£¨»òÕß·ÖÖ§£©ÆäʵÕë¶Ô¶ÀÁ¢µÄÎÊÌ⣬ÕâÑùÎÒÃǶÔÕâЩÎÊÌâÈôÓÐʲô¸üºÃµÄ½â¾ö·½·¨£¬Ìæ»»ÏàÓ¦µÄÄ£¿é±ãÊÇ£¬Òª²»´úÂë»ìÔÓÔÚÒ»Æðû·¨¿´ÁË¡£ÉÏÒ»²¿·Ö¾ÍÌáµ½ÁË£¬attachEventµÄʼþÁжӳöÁËЩÎÊÌ⣬ÎÒÃÇÒªÊÖ¶¯¹¹½¨ÁжÓÁË¡£ËùνÁжӾÍÊÇÓÐÏÈÓкóµÄÎÊÌâ£¬Ò ......