有人做过google眼睛的特效不,有的话给下代码。
不要google的原代码,谢谢

解决方案 »

  1.   

    百度了一下。嘿嘿。
    http://hi.baidu.com/hemaoqing/blog/item/d39c50c483a384cd38db4916.html
      

  2.   

    这是代码网页
    http://bbs.shudoo.com/viewthread.php?tid=1619268&page=1&authorid=377976
    这是效果图
    http://www.nmgqipai.com/html/qiaopai/20090412/284.html
      

  3.   

    为什么不要google的呢?
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    #EYES_pupil0114,#EYES_pupil1114{
    position:relative;
    width:15px;
    height:15px;
    left:52px;
    top:52px;
    }
    </style></head><body>
    <div>
    <table cellpadding=0 cellspacing=0 border=0 align=center style="margin-top:5px;">
        <tr>
        <td background="http://www.google.cn/ig/modules/eyes_content/eye-r.gif">
            <div style="width:117px;height:117px;">
                <img src="http://www.google.cn/ig/modules/eyes_content/pupil.gif" id="EYES_pupil0114">
            </div>
        </td>
        <td background="http://www.google.cn/ig/modules/eyes_content/eye-y.gif">
            <div style="width:117px;height:117px;">
                <img src="http://www.google.cn/ig/modules/eyes_content/pupil.gif" id="EYES_pupil1114">
            </div>
        </td>
        </tr>
    </table>
    </div>
    <script type="text/javascript">
    <!-- With thanks to Keith Packard and Jeremy Huxtable and Dylan Parker -->
    function $(id){
    return document.getElementById(id);
    }
    var EYES114 = {
        MAX_DIST: 37,
        // furthest pupil can move from center
        EYE_RADIUS: 59,
        // eye image width / 2
        PUPIL_RADIUS: 7,
        // pupil image width / 2
        pupils: [],
        init: function() {
            //_IG_AddDOMEventHandler(document, "mousemove", EYES114.moveEyes);
    document.onmousemove = EYES114.moveEyes;
            EYES114.pupils = [$("EYES_pupil0114"), $("EYES_pupil1114")];
        },
        moveEyes: function(e) {
            if (!e) e = window.event;
            var app = EYES114;
            for (var i = 0; i < app.pupils.length; i++) {
                var pupil = app.pupils[i];
                var midx = app.getPagePos(pupil.parentNode, true) + app.EYE_RADIUS;
                var midy = app.getPagePos(pupil.parentNode, false) + app.EYE_RADIUS;
                var scrollx = 0;
                var scrolly = 0;
                if (typeof(window.pageXOffset) == 'number') {
                    scrollx = window.pageXOffset;
                    scrolly = window.pageYOffset;
                } else {
                    scrollx = document.documentElement.scrollLeft;
                    scrolly = document.documentElement.scrollTop;
                }
                var distX = e.clientX + scrollx - midx;
                var distY = e.clientY + scrolly - midy;
                var dist = Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2));
                if (dist > app.MAX_DIST) {
                    var scale = app.MAX_DIST / dist;
                    distX *= scale;
                    distY *= scale;
                }
                pupil.style.left = parseInt(distX + app.EYE_RADIUS - app.PUPIL_RADIUS) + "px";
                pupil.style.top = parseInt(distY + app.EYE_RADIUS - app.PUPIL_RADIUS) + "px";
            }
        },
        getPagePos: function(el, left) {
            var val = 0;
            while (el != null) {
                val += el["offset" + (left ? "Left": "Top")];
                el = el.offsetParent;
            }
            return val;
        }
    };
    EYES114.init();
    </script>
    </body>
    </html>