html做一个下拉菜单,点击出现下面出现一个菜单,在点击就收回
1个回答
展开全部
use different id for each div, and same name for all div that toggle
in js function, use getElementsByName
<script>
function isHidden(oDiv) {
...
var allDiv = document.getElementsByName('toggle');
...
}
</script>
<body>
...
<a href= "javascript:void(0)" style="cursor:hand" onclick="isHidden('div1')"><font color="#0072E3"><strong>1.READ MORE</strong>
</font></a>
<div id="div1" name="toggle" style="display:none" class="STYLE5" >
<strong>Chairman:</strong> <em>Shiqian Ma</em></br></div>
...
<a href= "javascript:void(0)" style="cursor:hand" onclick="isHidden('div2')"><font color="#0072E3"><strong>1.READ MORE</strong>
</font></a>
<div id="div2" name="toggle" style="display:none" class="STYLE5" >
<strong>Chairman:</strong> <em>Shiqian Ma</em></br></div>
...
</body>
in js function, use getElementsByName
<script>
function isHidden(oDiv) {
...
var allDiv = document.getElementsByName('toggle');
...
}
</script>
<body>
...
<a href= "javascript:void(0)" style="cursor:hand" onclick="isHidden('div1')"><font color="#0072E3"><strong>1.READ MORE</strong>
</font></a>
<div id="div1" name="toggle" style="display:none" class="STYLE5" >
<strong>Chairman:</strong> <em>Shiqian Ma</em></br></div>
...
<a href= "javascript:void(0)" style="cursor:hand" onclick="isHidden('div2')"><font color="#0072E3"><strong>1.READ MORE</strong>
</font></a>
<div id="div2" name="toggle" style="display:none" class="STYLE5" >
<strong>Chairman:</strong> <em>Shiqian Ma</em></br></div>
...
</body>
追问
你这哪复制粘贴来的啊
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询