JS点击div时 展开隐藏的div同时可跳转链接

1.点击div class=aa时,显示其下方隐藏的div class=bb,同时跳转页面至cc.html
请问这个JS怎么写?

2.鼠标经过div class=aa时,显示其下方隐藏的div class=bb, 点击aa,跳转页面至cc.html
这个又怎么写?

你上面说了两个效果。。。。先给你一个效果。。看看。。

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#aa{cursor:pointer;}
 #box1{ width:400px;}
 #bb{display:none; margin-top:15px; margin-left:15px;}
  </style>
  <script type="text/javascript">


  document.getElementById(op).style.display="block";
 }
 function hide(op){
  document.getElementById(op).style.display="none";
 }
  </script>
</head>

<body>

<!--方法2-->
 <div id="box1">
   <div onmouseover="show('bb')" onmouseout="hide('bb')"  id="aa"><a href="cc.html" target="_blank">效果二</a></div>
   <div id="bb" style="border:1px #CCC solid;">==鼠标经时,显示其下方隐藏的。  点击效果二,跳转页面至cc.html==</div>
 </div>  
</body>



温馨提示:内容为网友见解,仅供参考
第1个回答  2013-07-15

    <body>

            <div class="aa">aa</div>

           <div class="bb"  style="display:none">bb</div>

        </body>

<script>

      $( document ).ready(function() {

                $(".aa").click(function(){

                        $(".bb").show();

                        window.open("/cc.html")//引号内是cc.html的路劲

                })

        })

</script>

2.

<script>

      $( document ).ready(function() {

                $(".aa").click(function(){

                        window.open("/cc.html")//引号内是cc.html的路劲

                }).mouseout(function(){

                         $(".bb").show();

                })

        })

</script>

相似回答