TabContrl

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>标签卡主页面</title>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
//切换标签函数
function clickTab(num){
 //获得标签对象
 var tab1 = document.getElementById("tab1");
 var tab2 = document.getElementById("tab2");
 var tab3 = document.getElementById("tab3");
 //获得需要控制的内容区域对象
 var tabarea1 = document.getElementById("tabarea1");
 var tabarea2 = document.getElementById("tabarea2");
 var tabarea3 = document.getElementById("tabarea3");
 //根据标签的序号执行不同内容
 switch( num ){
  case 1:
   //设置背景色 
   tab1.bgColor = "ff0000";
   tab2.bgColor = "";
   tab3.bgColor = "";
   //设置可见性 
   tabarea1.style.display = "block";
   tabarea2.style.display = "none";
   tabarea3.style.display = "none";
   break;
  case 2:
   //设置背景色 
   tab1.bgColor = "";
   tab2.bgColor = "ff0000";
   tab3.bgColor = "";
   //设置可见性 
   tabarea1.style.display = "none";
   tabarea2.style.display = "block";
   tabarea3.style.display = "none";
   break;
  case 3:
   //设置背景色 
   tab1.bgColor = "";
   tab2.bgColor = "";
   tab3.bgColor = "ff0000";
   //设置可见性 
   tabarea1.style.display = "none";
   tabarea2.style.display = "none";
   tabarea3.style.display = "block";
   break;
 }
}
//-->
</script>
</head>
<body>
<table border="1">
<tr>
<td id="tab1" bgcolor="#ff0000" onclick="clickTab(1)">标签卡1</td>
<td id="tab2" onclick="clickTab(2)">访问yahoo</td>
<td id="tab3" onclick="clickTab(3)">标签卡3</td>
</tr>
</table>
<table width="400" border="1" height="300">
<tr id="tabarea1" style="display:block;">
<td>标签卡1需要显示的内容</td>
</tr>
<tr id="tabarea2" style="display:none;">
<td><iframe width="100%" height="100%" src="http://www.yahoo.com.cn"></iframe></td>
</tr>
<tr id="tabarea3" style="display:none;">
<td>标签卡3需要显示的内容</td>
</tr>
</table>
</body>
</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值