首页 > 代码库 > 鼠标点击换样式事件方法

鼠标点击换样式事件方法

<style type="text/css">

.aa{ width:90px; height:60px;text-align:center; vertical-align:middle; line-height:60px; margin-right:10px; font-size:19px; float:left;

background-color:#06F}

</style>

 

<body>

<div style=" width:990px; height:60px; background-color:#F0F;">
<div class="aa" style="border-bottom:2px solid #F00;">点击1</div>
<div class="aa">点击2</div>
<div class="aa">点击3</div>
<div class="aa">点击4</div>
<div class="aa">点击5</div>
</div>

</body>

 

<script type="text/javascript">
  $(document).ready(function(e)
{
      $(".aa").click(function()
    {
        $(".aa").css("color","#000");
        $(".aa").css("font-weight","400");
        $(".aa").css("border-bottom-style","solid");
        $(".aa").css("border-bottom","1px");
        $(this).css("color","red");


      $(this).css("font-weight","bold");
      $(this).css("border-bottom","2px");
      $(this).css("border-bottom-style","solid");
      $(this).css("border-bottom-color","red");
    })
});

鼠标点击换样式事件方法