能举个关于切换样式的例子么谢谢

解决方案 »

  1.   


    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <style>
    div {
    width:100px; height:100px;
    background:#eee;
    }
    </style>
    </head>
    <body>
    <div id="test"></div>
    <script>
    $('#test').mouseover(function(){
    $(this).css('backgroundColor', 'red');
    }).mouseout(function(){
    $(this).css('backgroundColor', '#eee');
    })
    </script>
    </body>
    </html>
    楼主 学学 jquery吧
    http://www.w3school.com.cn/jquery/index.asp
      

  2.   

    有现成的模拟hover伪类,何必费那个劲还加onmouseover和onmouseout?<html>
    <head>
    <title>Jquery Hover</title>
    </head>
     <script src="http://code.jquery.com/jquery.js"></script>
    <script>
    $(function (){
    $("button").hover(
    function(){
    alert("do onMouseover");
    },
    function(){
    alert("do onMouseout");
    }
    );
    })
    </script>
    <body>
    <button>Button</button>
    </body>
    </html>