<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<title>my_tab</title>
<META
http-equiv=Content-Type content="text/html;
charset=utf-8">
<style>
ul, li{list-style:none;}
#tab ul
li{float:left;width:40px;}
.clearBoth{clear:both;}
.ok{display:none;}
.dis{display:block;}
</style>
<body>
<div
id="tab">
<ul>
<li><a onClick="selectTag(‘tagContent0‘, this)"
href="javascript:void(0)">1111</a></li>
<li><a onClick="selectTag(‘tagContent1‘,
this)" href="javascript:void(0)">222</a></li>
<li><a onClick="selectTag(‘tagContent2‘,
this)" href="javascript:void(0)">333</a></li>
</ul>
<br class="clearBoth"
/>
<div id="tagContent0" class="ok
dis">
xxxxx
</div>
<div id="tagContent1"
class="ok">
yyyyyyyyyyy
</div>
<div id="tagContent2"
class="ok">
zzzzz
</div>
</div>
<script>
function
selectTag(showContent, selfObj)
{
var tag =
document.getElementById("tab").getElementsByTagName("li");
var tagLength = tag.length;
for(i=0; i<tagLength;
i++)
{
tag[i].className = "";
}
selfObj.parentNode.className = "selectTag";
for(i=0; j=document.getElementById("tagContent"+i); i++)
{
if(i >= tagLength)
break;
j.style.display =
"none";
}
document.getElementById(showContent).style.display="block";
}
</script>
</body>
</html>
相关文章
- 09-22Eclipse能否把选中的一段代码向前或向后缩进一个tab的位
- 09-22vue ant-tab中页面切换使用component传参 props
- 09-22tabs切换tab页中的echart图变形,宽高仅100px问题
- 09-22EasyUI--权限管理(三)显示tab页上的按钮
- 09-22# Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezone‘ prope
- 09-22三行代码实现TabLayout+ViewPager的Tab滑动效果,从封装到开源
- 09-22关于 \t 水平制表符 Horizontal Tab (TAB)
- 09-22延迟加载onclick listview
- 09-22前端必学----tab切换
- 09-22原生js面对对象Tab栏