日期:2014-05-16  浏览次数:20386 次

javascript 标签转换
<script>
	function tabFlexSwitch(source,id) {
		if (source == 'kxx') {
			var idArray = new Array("shijian", "jihua", "diyu");
			changTab(id, source, idArray);
		}
	}
	function changTab(id, source, idArray) {
		for (var i = 0; i < idArray.length; i++) {
			if (id == idArray[i]) {
				document.getElementById(source + id + '_a').style.display = "none";
				document.getElementById(source + id).style.display = "";
			} else {
				document.getElementById(source + idArray[i] + '_a').style.display = "";
				document.getElementById(source + idArray[i]).style.display = "none";
			}
		}
	}
</script>

<div class="stat-bar">
	<span id="kxxshijian_a"><a onclick="tabFlexSwitch('kxx', 'shijian')">时间统计</a></span>
	<span id="kxxshijian" class=active style="display:none">时间统计</span>
	<span id="kxxjihua_a" style="display:none"><a onclick="tabFlexSwitch('kxx', 'jihua')">计划类型统计</a></span>
	<span id="kxxjihua" class=active>计划类型统计</span>
	<span id="kxxdiyu_a"><a onclick="tabFlexSwitch('kxx', 'diyu')">地域统计</a></span>
	<span id="kxxdiyu" class=active style="display:none">地域统计</span>
</div>
<style type="text/css">
	background-color:#33CCFF;
	color:#FFFFFF;
	font-size:1.2em;
	height:25px;
	line-height:1.8em;
	overflow:hidden;
	padding:5px 0 0 10px;
}
 .stat-bar a {
	background-color:#66CCFF;
	color:#FFFFFF !important;
	padding:5px 8px 4px;
}
 .stat-bar .active {
	background-color:#FFFFFF;
	color:#0000CC;
	font-weight:bold;
	padding:5px 10px 4px;
}
</style>