(047)jquery_事件_toggle

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>dom_toggle.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <script type="text/javascript" src="../js/jquery/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(function(){
            $("div").toggle(function(){
                $(this).html("苹果");
            },function(){
                $(this).html("梨子");
            },function(){
                $(this).html("菠萝");
            });
        });
    </script>
  </head>
  
  <body>
        <div>我是动态显示的</div>
  </body>
</html>

使用toggle()方法绑定多个函数

toggle()方法多函数支持目前主流稳定的jQuery版本1.8.2,在1.9.0之后的版本是不支持的。

posted @ 2014-12-22 16:30  雪中飞雁  阅读(64)  评论(0)    收藏  举报