添加浮动广告
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- saved from url=(0042)http://www.admin5.com/myjs/htm/data/js.htm -->
3<HTML><HEAD><TITLE>JAVASCRIPT对象及属性</TITLE>
4<META http-equiv=Content-Type content="text/html; charset=gb2312">
5<STYLE>P {
6 FONT: menu; LINE-HEIGHT: 150%
7}
8</STYLE>
9
10<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
11<BODY text=#000000 bgColor=#ffffff>
12<TABLE width="100%" height="846" border=0 cellPadding=1 cellSpacing=4>
13 <TBODY>
14 <TR>
15 <TD vAlign=top width=155 bgColor=#eeeeee>
16 <DIV id=floater
17 style="Z-INDEX: 1; LEFT: 1%; WIDTH: 153px; POSITION: absolute; TOP: 10px; HEIGHT: 31px; background-color: #FF0000; layer-background-color: #FF0000; border: 1px none #000000;"> 内容
18
19 <DIV id=floater1
20 style="Z-INDEX: 1; LEFT: 500%; WIDTH: 153px; POSITION: absolute; TOP: 0px; HEIGHT: 31px; background-color: #FF0000; layer-background-color: #FF0000; border: 1px none #000000;"> 内容 </DIV> </DIV>
21 <SCRIPT language=JavaScript>
22 self.onError=null;
23 currentX = currentY = 0;
24 whichIt = null;
25 lastScrollX = 0; lastScrollY = 0;
26 NS = (document.layers) ? 1 : 0;
27 IE = (document.all) ? 1: 0;
28 <!-- STALKER CODE -->
29 function heartBeat() {
30 if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
31 if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
32 if(diffY != lastScrollY) {
33 percent = .1 * (diffY - lastScrollY);
34 if(percent > 0) percent = Math.ceil(percent);
35 else percent = Math.floor(percent);
36 if(IE) document.all.floater.style.pixelTop += percent;
37 if(NS) document.floater.top += percent;
38 lastScrollY = lastScrollY + percent;
39 }
40 if(diffX != lastScrollX) {
41 percent = .1 * (diffX - lastScrollX);
42 if(percent > 0) percent = Math.ceil(percent);
43 else percent = Math.floor(percent);
44 if(IE) document.all.floater.style.pixelLeft += percent;
45 if(NS) document.floater.left += percent;
46 lastScrollX = lastScrollX + percent;
47 }
48 }
49 <!-- /STALKER CODE -->
50 <!-- DRAG DROP CODE -->
51 function checkFocus(x,y) {
52 stalkerx = document.floater.pageX;
53 stalkery = document.floater.pageY;
54 stalkerwidth = document.floater.clip.width;
55 stalkerheight = document.floater.clip.height;
56 if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
57 else return false;
58 }
59 function grabIt(e) {
60 if(IE) {
61 whichIt = event.srcElement;
62 while (whichIt.id.indexOf("floater") == -1) {
63 whichIt = whichIt.parentElement;
64 if (whichIt == null) { return true; }
65 }
66 whichIt.style.pixelLeft = whichIt.offsetLeft;
67 whichIt.style.pixelTop = whichIt.offsetTop;
68 currentX = (event.clientX + document.body.scrollLeft);
69 currentY = (event.clientY + document.body.scrollTop);
70 } else {
71 window.captureEvents(Event.MOUSEMOVE);
72 if(checkFocus (e.pageX,e.pageY)) {
73 whichIt = document.floater;
74 StalkerTouchedX = e.pageX-document.floater.pageX;
75 StalkerTouchedY = e.pageY-document.floater.pageY;
76 }
77 }
78 return true;
79 }
80 function moveIt(e) {
81 if (whichIt == null) { return false; }
82 if(IE) {
83 newX = (event.clientX + document.body.scrollLeft);
84 newY = (event.clientY + document.body.scrollTop);
85 distanceX = (newX - currentX); distanceY = (newY - currentY);
86 currentX = newX; currentY = newY;
87 whichIt.style.pixelLeft += distanceX;
88 whichIt.style.pixelTop += distanceY;
89 if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
90 if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
91 if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
92 if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
93 event.returnValue = false;
94 } else {
95 whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
96 if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
97 if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
98 if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
99 if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
100 return false;
101 }
102 return false;
103 }
104 function dropIt() {
105 whichIt = null;
106 if(NS) window.releaseEvents (Event.MOUSEMOVE);
107 return true;
108 }
109 <!-- DRAG DROP CODE -->
110 if(NS) {
111 window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
112 window.onmousedown = grabIt;
113 window.onmousemove = moveIt;
114 window.onmouseup = dropIt;
115 }
116 if(IE) {
117 document.onmousedown = grabIt;
118 document.onmousemove = moveIt;
119 document.onmouseup = dropIt;
120 }
121 if(NS || IE) action = window.setInterval("heartBeat()",1);
122</SCRIPT>
123
124 </TD>
125<TD><FONT face="Geneva, Arial, Helvetica, san-serif" size=3><B><FONT
126color=#990000 size=7></P></TD></TR></TBODY></TABLE></BODY></HTML>
127
2<!-- saved from url=(0042)http://www.admin5.com/myjs/htm/data/js.htm -->
3<HTML><HEAD><TITLE>JAVASCRIPT对象及属性</TITLE>
4<META http-equiv=Content-Type content="text/html; charset=gb2312">
5<STYLE>P {
6 FONT: menu; LINE-HEIGHT: 150%
7}
8</STYLE>
9
10<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
11<BODY text=#000000 bgColor=#ffffff>
12<TABLE width="100%" height="846" border=0 cellPadding=1 cellSpacing=4>
13 <TBODY>
14 <TR>
15 <TD vAlign=top width=155 bgColor=#eeeeee>
16 <DIV id=floater
17 style="Z-INDEX: 1; LEFT: 1%; WIDTH: 153px; POSITION: absolute; TOP: 10px; HEIGHT: 31px; background-color: #FF0000; layer-background-color: #FF0000; border: 1px none #000000;"> 内容
18
19 <DIV id=floater1
20 style="Z-INDEX: 1; LEFT: 500%; WIDTH: 153px; POSITION: absolute; TOP: 0px; HEIGHT: 31px; background-color: #FF0000; layer-background-color: #FF0000; border: 1px none #000000;"> 内容 </DIV> </DIV>
21 <SCRIPT language=JavaScript>
22 self.onError=null;
23 currentX = currentY = 0;
24 whichIt = null;
25 lastScrollX = 0; lastScrollY = 0;
26 NS = (document.layers) ? 1 : 0;
27 IE = (document.all) ? 1: 0;
28 <!-- STALKER CODE -->
29 function heartBeat() {
30 if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
31 if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
32 if(diffY != lastScrollY) {
33 percent = .1 * (diffY - lastScrollY);
34 if(percent > 0) percent = Math.ceil(percent);
35 else percent = Math.floor(percent);
36 if(IE) document.all.floater.style.pixelTop += percent;
37 if(NS) document.floater.top += percent;
38 lastScrollY = lastScrollY + percent;
39 }
40 if(diffX != lastScrollX) {
41 percent = .1 * (diffX - lastScrollX);
42 if(percent > 0) percent = Math.ceil(percent);
43 else percent = Math.floor(percent);
44 if(IE) document.all.floater.style.pixelLeft += percent;
45 if(NS) document.floater.left += percent;
46 lastScrollX = lastScrollX + percent;
47 }
48 }
49 <!-- /STALKER CODE -->
50 <!-- DRAG DROP CODE -->
51 function checkFocus(x,y) {
52 stalkerx = document.floater.pageX;
53 stalkery = document.floater.pageY;
54 stalkerwidth = document.floater.clip.width;
55 stalkerheight = document.floater.clip.height;
56 if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
57 else return false;
58 }
59 function grabIt(e) {
60 if(IE) {
61 whichIt = event.srcElement;
62 while (whichIt.id.indexOf("floater") == -1) {
63 whichIt = whichIt.parentElement;
64 if (whichIt == null) { return true; }
65 }
66 whichIt.style.pixelLeft = whichIt.offsetLeft;
67 whichIt.style.pixelTop = whichIt.offsetTop;
68 currentX = (event.clientX + document.body.scrollLeft);
69 currentY = (event.clientY + document.body.scrollTop);
70 } else {
71 window.captureEvents(Event.MOUSEMOVE);
72 if(checkFocus (e.pageX,e.pageY)) {
73 whichIt = document.floater;
74 StalkerTouchedX = e.pageX-document.floater.pageX;
75 StalkerTouchedY = e.pageY-document.floater.pageY;
76 }
77 }
78 return true;
79 }
80 function moveIt(e) {
81 if (whichIt == null) { return false; }
82 if(IE) {
83 newX = (event.clientX + document.body.scrollLeft);
84 newY = (event.clientY + document.body.scrollTop);
85 distanceX = (newX - currentX); distanceY = (newY - currentY);
86 currentX = newX; currentY = newY;
87 whichIt.style.pixelLeft += distanceX;
88 whichIt.style.pixelTop += distanceY;
89 if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
90 if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
91 if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
92 if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
93 event.returnValue = false;
94 } else {
95 whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
96 if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
97 if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
98 if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
99 if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
100 return false;
101 }
102 return false;
103 }
104 function dropIt() {
105 whichIt = null;
106 if(NS) window.releaseEvents (Event.MOUSEMOVE);
107 return true;
108 }
109 <!-- DRAG DROP CODE -->
110 if(NS) {
111 window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
112 window.onmousedown = grabIt;
113 window.onmousemove = moveIt;
114 window.onmouseup = dropIt;
115 }
116 if(IE) {
117 document.onmousedown = grabIt;
118 document.onmousemove = moveIt;
119 document.onmouseup = dropIt;
120 }
121 if(NS || IE) action = window.setInterval("heartBeat()",1);
122</SCRIPT>
123
124 </TD>
125<TD><FONT face="Geneva, Arial, Helvetica, san-serif" size=3><B><FONT
126color=#990000 size=7></P></TD></TR></TBODY></TABLE></BODY></HTML>
127