怎样循环5个DIV(层)?点击其中一个隐藏其它??? 怎样点击其中一个DIV(层),隐藏其它DIV(层)??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Dreamweaver里手动操作可以自动生成代码。 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>shawl.qiu template</title><script type="text/javascript">//<![CDATA[ onload=function() { var oDiv=document.getElementById("main").getElementsByTagName("div"); for(var i=0, j=oDiv.length; i<j; i++) { oDiv[i].onclick=function() { fHdOth(this); } } } function fHdOth(oDiv) { var oDivRg=oDiv.parentNode.getElementsByTagName("div"); for(var i=0, j=oDivRg.length; i<j; i++) { if(oDiv==oDivRg[i])continue; oDivRg[i].style.display="none"; } } // shawl.qiu script//]]></script></head><body><div id='main'> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div></div></body></html> 这个问题和你的一样,http://community.csdn.net/Expert/topic/5335/5335616.xml?temp=.1560633参看解答 图片特效 js 缺少对象!!三层树形菜单,前两个没问题后一个报错 求:图片的渐出效果 散一个模拟DIV滚动条实例 一个很奇怪的问题 关于undefined js能实现查看和取得剪贴板的功能吗 如何在提交之后不弹出提交后的页面?? 帮忙看看? 异步加载js文件,在IE11下不行,请问怎么能兼容11? jQuery 动态改变背景图片 时好时坏 如何实现文本控件输入数据时,动态提示数据表中的数据并选择输入的数据 在隐藏层中取 table 的clientWidth为0. 有啥办法能取到宽度?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shawl.qiu template</title>
<script type="text/javascript">
//<![CDATA[
onload=function()
{
var oDiv=document.getElementById("main").getElementsByTagName("div");
for(var i=0, j=oDiv.length; i<j; i++)
{
oDiv[i].onclick=function()
{
fHdOth(this);
}
}
}
function fHdOth(oDiv)
{
var oDivRg=oDiv.parentNode.getElementsByTagName("div");
for(var i=0, j=oDivRg.length; i<j; i++)
{
if(oDiv==oDivRg[i])continue;
oDivRg[i].style.display="none";
}
} // shawl.qiu script
//]]>
</script>
</head>
<body>
<div id='main'>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
</body>
</html>
http://community.csdn.net/Expert/topic/5335/5335616.xml?temp=.1560633
参看解答