仿265上网导航眼睛会动的LOGO...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>仿265上网导航眼睛会动的LOGO丨中国技术教程网</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> </head> <body> <!--把下面代码加到<body>与</body>之间--> <div id="logo"><a><img id="logoimg" src="http://www.update8.com/js_img/9-04/images/top-logo.gif"></a></div> <script language="javascript"> /*变量说明: qb:遮挡图片横坐标 rb:遮挡图片纵坐标 sb:左眼图片横坐标 tb:左眼图片纵坐标 ub:右眼图片横坐标 vb:右眼图片纵坐标 ----- wb:左眼图片初始横坐标 xb:左眼图片初始纵坐标 yb:右眼图片初始横坐标 zb:右眼图片初始纵坐标 ----- Ab:眼睛运动范围(椭圆形)横轴长度 Bb:眼睛运动范围(椭圆形)纵轴长度 ----- Cb:作用不详,保持默认即可 Db:眼睛鼠标运动的灵敏程度 ----- Fb:logo图片地址 Y.src:遮挡眼睛的图片地址 Z.src:眼睛的图片地址 */ function m(a, b) { return a.position = b } function o(a, b) { return a.left = b } function ca(a, b) { return a.zIndex = b } var p = "length", r = "style", s = "body", x, y; function U(a) { return document.createElement(a) } var Y, mb, nb, ob, pb, Z, $; var qb = 20, rb = 22, sb = 20, tb = 28, ub = 33, vb = 28, wb = 22, xb = 27, yb = 31, zb = 27, Ab = 6, Bb = 4, Cb = 1, Db = 200; var Eb; var Fb = "http://www.update8.com/js_img/9-04/images/top-logo.gif"; function Gb(a) { var b = 0, c = 0; if (a.pageX || a.pageY) { b = a.pageX; c = a.pageY } else if (a.clientX || a.clientY) { b = a.clientX + document[s].scrollLeft; c = a.clientY + document[s].scrollTop } return [b, c] } function Ib(a) { Jb(); a = a || document.parentWindow.event; var b = Gb(a), c = b[0], d = b[1]; Kb(c, d, Z, sb, tb); Kb(c, d, $, ub, vb) } function Kb(a, b, c, d, g) { var e = a - d - mb, f = (b - g - nb) * (Ab / Bb), j = Math.sqrt(Math.pow(e, 2) + Math.pow(f, 2)), h, l; if (j == 0) { h = d; l = g } else { var B = Math.sqrt(Math.pow(j, 2) + Math.pow(Db, 2)), E = Ab * j / B; h = E * e / j + d + mb; l = E * f / j / (Ab / Bb) + g + nb } h -= Cb; l -= Cb; o(c[r], parseInt(h, 10) + "px"); c[r].top = parseInt(l, 10) + "px" } function EYES_init() { var a = Mb("logo"), b = Nb(a, "a"); Eb = Nb(a, "img"); if ( - 1 == Eb.src.indexOf(Fb)) { return } Y = U("img"); Z = U("img"); $ = U("img"); Y.border = (Z.border = ($.border = 0)); Y.src = "http://www.update8.com/js_img/9-04/images/dang.gif"; Z.src = ($.src = "http://www.update8.com/js_img/9-04/images/eye.gif"); Jb(); m(Y[r], m(Z[r], m($[r], "absolute"))); ca(Y[r], 90); ca(Z[r], ca($[r], 100)); b.appendChild(Y); b.appendChild(Z); b.appendChild($); document.onmousemove = Ib; T(window, "pageshow", Jb); T(window, "resize", Jb) } function Jb() { var a = Ob(Eb); mb = a.x; nb = a.y; ob = Eb.width; pb = Eb[p]; var b = "px"; o(Y[r], mb + qb + b); Y[r].top = nb + rb + b; o(Z[r], a.x + wb + b); Z[r].top = a.y + xb + b; o($[r], a.x + yb + b); $[r].top = a.y + zb + b } function Ob(a) { var b = a.offsetLeft, c = a.offsetTop; if (a.offsetParent != null) { var d = Ob(a.offsetParent); b += d.x; c += d.y; } return{x:b,y:c} } function T(a, b, c) { var d = "on" + b; if (a.addEventListener) { a.addEventListener(b, c, false) } else if (a.attachEvent) { a.attachEvent(d, c) } else { var g = a[d]; a[d] = function() { var e = g.apply(this, arguments), f = c.apply(this, arguments); return e == undefined ? f : (f == undefined ? e : f && e) } } }; function Mb(a) { return document.getElementById(a) } function Nb(a, b) { return a.getElementsByTagName(b)[0] } EYES_init(); </script> </body> </html> <p align="center">本特效由 <a href="http://www.update8.com">中国技术教程网</a> 收集于互联网,只为兴趣与学习交流,不作商业用途。</p>