那位大哥能写个小例子给我看看么非常感谢

解决方案 »

  1.   

    <div>
        <a onmouseover="mouseOver(this)" onmouseout="mouseOut(this)">鼠标放在上面就知道了</a>
        </div>    <script type="text/javascript">
            function mouseOver(o) {
                o.style.backgroundColor = "red";
            }
            function mouseOut(o) {
                o.style.backgroundColor = "blue";
            }
        </script>
      

  2.   


    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    </head>
    <body>
    <div id="test" style="border:1px solid red;">移动上来</div>
    <script>
    function $(el){
    return typeof el == 'string' ? document.getElementById(el) : el;
    }
    $('test').onmouseover=function(){
    this.style.border = '2px solid blue';
    }
    $('test').onmouseout = function(){
    this.style.border = '2px solid red';
    }
    </script>
    </body>
    </html>