查看完整版本: 大眼仔滑鼠游標

24-1-2010 09:35

大眼仔滑鼠游標

<script LANGUAGE="JavaScript">
<!--
var brOK = false, mie = false;
if (document.layers || document.all) brOK = true;
if (document.all) mie = true;
var ex = 0, ey = 0;
var ae, le, re, x0, y0, tid, realx, realy;
function navMove(e) {
ex = e.pageX;
ey = e.pageY;
moveeye()
return routeEvent(e);
}
function mieMove() {
ex = document.body.scrollLeft + event.x;
ey = document.body.scrollTop + event.y;
moveeye();
}
function moveeye() {
dy = ey - y0 - 20;
dx1 = ex - x0 - 20;
dx2 = ex - x0 - 60;
r = Math.sqrt(dx1 * dx1 + dy * dy);
if (r < 20) r = 20;
dx1 = dx1 * 10 / r + x0 + 10;
dy1 = dy * 10 / r + y0 + 10;
r = Math.sqrt(dx2 * dx2 + dy * dy);
if (r < 20) r = 20;
dx2 = dx2 * 10 / r + x0 + 50;
ae.left = x0;
ae.top = y0;
le.left = dx1;
le.top = dy1;
re.left = dx2;
re.top = dy1;
}
function setHandlers() {
if (!mie) {
y0 = document.eyeballs.top;
x0 = document.eyeballs.left;
ae = document.eyeballs;
le = document.lefteye;
re = document.righteye;
window.captureEvents(Event.MOUSEMOVE);
window.onMouseMove = navMove;
}
else {
y0 = document.all.eyeballs.style.pixelTop;
x0 = document.all.eyeballs.style.pixelLeft;
ae = document.all.eyeballs.style;
le = document.all.lefteye.style;
re = document.all.righteye.style;
window.document.onmousemove = mieMove;
}
realx = x0 + 0.1;
realy = y0 + 0.1;
moveall();
}
function moveall() {
rx = realx + 40;
ry = realy + 40;
rx += (ex - rx) * 0.1;
ry += (ey - ry) * 0.1;
realx = rx - 40;
realy = ry - 40;
x0 = Math.round(realx);
y0 = Math.round(realy);
moveeye();
tid = setTimeout('moveall()', 100);
}
function placeeyes(x, y) {
if (brOK) {
ex = x + 40;
ey = y + 40;
s = '<DIV ID ="dummy" STYLE="position:absolute; ' +
'top:'+y+'; left:'+x+'; width:10; height:10;"> </DIV>';
s += '<DIV ID="eyeballs" STYLE="position:absolute; ' +
'top:'+y+'; left:'+x+'; width:80; height:40;"><IMG SRC=' +
'"http://www.bunbunhk.com/BBS/js/eye1.gif" border=0></DIV>';
s += '<DIV ID="lefteye" STYLE="position:absolute; ' +
'top:'+(y+10)+'; left:'+(x+10)+'; width:20; height:20;">' +
'<IMG SRC="http://www.bunbunhk.com/BBS/js/eye2.gif" border=0></DIV>';
s += '<DIV ID="righteye" STYLE="position:absolute; ' +
'top:'+(y+10)+'; left:'+(x+50)+'; width:20; height:20;">' +
'<IMG SRC="http://www.bunbunhk.com/BBS/js/eye2.gif" border=0></DIV>';
document.writeln(s);
}
}
function clearEyes() {
if (tid) clearTimeout(tid);
}
placeeyes(200, 100);
window.onload = setHandlers;
window.onunload = clearEyes;
-->
</script>



<BR><BR><BR><BR>
<BR><BR>
<BR><BR>
<BR><BR>
<BR><BR>





&lt;script LANGUAGE="JavaScript"&gt;<BR>&lt;!--<BR>var brOK = false, mie = false;<BR>if (document.layers || document.all) brOK = true;<BR>if (document.all) mie = true;<BR>var ex = 0, ey = 0;<BR>var ae, le, re, x0, y0, tid, realx, realy;<BR>function navMove(e) {<BR>ex = e.pageX; <BR>ey = e.pageY;<BR>moveeye()<BR>return routeEvent(e);<BR>}<BR>function mieMove() {<BR>ex = document.body.scrollLeft + event.x;<BR>ey = document.body.scrollTop + event.y;<BR>moveeye();<BR>}<BR>function moveeye() {<BR>dy = ey - y0 - 20;<BR>dx1 = ex - x0 - 20;<BR>dx2 = ex - x0 - 60;<BR>r = Math.sqrt(dx1 * dx1 + dy * dy);<BR>if (r &lt; 20) r = 20;<BR>dx1 = dx1 * 10 / r + x0 + 10;<BR>dy1 = dy * 10 / r + y0 + 10;<BR>r = Math.sqrt(dx2 * dx2 + dy * dy);<BR>if (r &lt; 20) r = 20;<BR>dx2 = dx2 * 10 / r + x0 + 50;<BR>ae.left = x0;<BR>ae.top = y0;<BR>le.left = dx1;<BR>le.top = dy1;<BR>re.left = dx2;<BR>re.top = dy1;<BR>}<BR>function setHandlers() {<BR>if (!mie) {<BR>y0 = document.eyeballs.top;<BR>x0 = document.eyeballs.left;<BR>ae = document.eyeballs;<BR>le = document.lefteye; <BR>re = document.righteye; <BR>window.captureEvents(Event.MOUSEMOVE);<BR>window.onMouseMove = navMove;<BR>} <BR>else {<BR>y0 = document.all.eyeballs.style.pixelTop;<BR>x0 = document.all.eyeballs.style.pixelLeft;<BR>ae = document.all.eyeballs.style;<BR>le = document.all.lefteye.style;<BR>re = document.all.righteye.style;<BR>window.document.onmousemove = mieMove;<BR>}<BR>realx = x0 + 0.1;<BR>realy = y0 + 0.1;<BR>moveall();<BR>}<BR>function moveall() {<BR>rx = realx + 40;<BR>ry = realy + 40;<BR>rx += (ex - rx) * 0.1;<BR>ry += (ey - ry) * 0.1;<BR>realx = rx - 40;<BR>realy = ry - 40;<BR>x0 = Math.round(realx);<BR>y0 = Math.round(realy);<BR>moveeye();<BR>tid = setTimeout('moveall()', 100);<BR>}<BR>function placeeyes(x, y) {<BR>if (brOK) {<BR>ex = x + 40;<BR>ey = y + 40;<BR>s = '&lt;DIV ID ="dummy" STYLE="position:absolute; ' +<BR>'top:'+y+'; left:'+x+'; width:10; height:10;"&gt; &lt;/DIV&gt;';<BR>s += '&lt;DIV ID="eyeballs" STYLE="position:absolute; ' +<BR>'top:'+y+'; left:'+x+'; width:80; height:40;"&gt;&lt;IMG SRC=' +<BR>'"<A href="http://www.bunbunhk.com/BBS/js/eye1.gif">http://www.bunbunhk.com/BBS/js/eye1.gif</A>" border=0&gt;&lt;/DIV&gt;';<BR>s += '&lt;DIV ID="lefteye" STYLE="position:absolute; ' + <BR>'top:'+(y+10)+'; left:'+(x+10)+'; width:20; height:20;"&gt;' +<BR>'&lt;IMG SRC="<A href="http://www.bunbunhk.com/BBS/js/eye2.gif">http://www.bunbunhk.com/BBS/js/eye2.gif</A>" border=0&gt;&lt;/DIV&gt;';<BR>s += '&lt;DIV ID="righteye" STYLE="position:absolute; ' +<BR>'top:'+(y+10)+'; left:'+(x+50)+'; width:20; height:20;"&gt;' +<BR>'&lt;IMG SRC="<A href="http://www.bunbunhk.com/BBS/js/eye2.gif">http://www.bunbunhk.com/BBS/js/eye2.gif</A>" border=0&gt;&lt;/DIV&gt;';<BR>document.writeln(s); <BR>}<BR>}<BR>function clearEyes() {<BR>if (tid) clearTimeout(tid);<BR>}<BR>placeeyes(200, 100);<BR>window.onload = setHandlers;<BR>window.onunload = clearEyes;<BR>--&gt;<BR>&lt;/script&gt;

25-5-2013 16:00

複製上列語法

<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<script LANGUAGE="JavaScript">
<!--
var brOK = false, mie = false;
if (document.layers || document.all) brOK = true;
if (document.all) mie = true;
var ex = 0, ey = 0;
var ae, le, re, x0, y0, tid, realx, realy;
function navMove(e) {
ex = e.pageX;
ey = e.pageY;
moveeye()
return routeEvent(e);
}
function mieMove() {
ex = document.body.scrollLeft + event.x;
ey = document.body.scrollTop + event.y;
moveeye();
}
function moveeye() {
dy = ey - y0 - 20;
dx1 = ex - x0 - 20;
dx2 = ex - x0 - 60;
r = Math.sqrt(dx1 * dx1 + dy * dy);
if (r < 20) r = 20;
dx1 = dx1 * 10 / r + x0 + 10;
dy1 = dy * 10 / r + y0 + 10;
r = Math.sqrt(dx2 * dx2 + dy * dy);
if (r < 20) r = 20;
dx2 = dx2 * 10 / r + x0 + 50;
ae.left = x0;
ae.top = y0;
le.left = dx1;
le.top = dy1;
re.left = dx2;
re.top = dy1;
}
function setHandlers() {
if (!mie) {
y0 = document.eyeballs.top;
x0 = document.eyeballs.left;
ae = document.eyeballs;
le = document.lefteye;
re = document.righteye;
window.captureEvents(Event.MOUSEMOVE);
window.onMouseMove = navMove;
}
else {
y0 = document.all.eyeballs.style.pixelTop;
x0 = document.all.eyeballs.style.pixelLeft;
ae = document.all.eyeballs.style;
le = document.all.lefteye.style;
re = document.all.righteye.style;
window.document.onmousemove = mieMove;
}
realx = x0 + 0.1;
realy = y0 + 0.1;
moveall();
}
function moveall() {
rx = realx + 40;
ry = realy + 40;
rx += (ex - rx) * 0.1;
ry += (ey - ry) * 0.1;
realx = rx - 40;
realy = ry - 40;
x0 = Math.round(realx);
y0 = Math.round(realy);
moveeye();
tid = setTimeout('moveall()', 100);
}
function placeeyes(x, y) {
if (brOK) {
ex = x + 40;
ey = y + 40;
s = '<DIV ID ="dummy" STYLE="position:absolute; ' +
'top:'+y+'; left:'+x+'; width:10; height:10;"> </DIV>';
s += '<DIV ID="eyeballs" STYLE="position:absolute; ' +
'top:'+y+'; left:'+x+'; width:80; height:40;"><IMG SRC=' +
'"http://www.bunbunhk.com/BBS/js/eye1.gif" border=0></DIV>';
s += '<DIV ID="lefteye" STYLE="position:absolute; ' +
'top:'+(y+10)+'; left:'+(x+10)+'; width:20; height:20;">' +
'<IMG SRC="http://www.bunbunhk.com/BBS/js/eye2.gif" border=0></DIV>';
s += '<DIV ID="righteye" STYLE="position:absolute; ' +
'top:'+(y+10)+'; left:'+(x+50)+'; width:20; height:20;">' +
'<IMG SRC="http://www.bunbunhk.com/BBS/js/eye2.gif" border=0></DIV>';
document.writeln(s);
}
}
function clearEyes() {
if (tid) clearTimeout(tid);
}
placeeyes(200, 100);
window.onload = setHandlers;
window.onunload = clearEyes;
-->
</script>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>

<br>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
頁: [1]
查看完整版本: 大眼仔滑鼠游標