tabmenu.js

来自「BI经营分析系统基于Hyperion Analyzer 前端展现层完整代码」· JavaScript 代码 · 共 55 行

JS
55
字号
function fnTabClick(nTab)	{
    setCookie(nTab);
	nTab = parseInt(nTab);
	var oTab;
	var prevTab = nTab-1;
	var nextTab = nTab+1;
	//event.cancelBubble = true;
	//el = event.srcElement;

	for (var i = 0; i < newsContent.length; i++){
		oTab = tabs[i];
		oTab.className = "clsTab";
		oTab.style.borderLeftStyle = "";
		oTab.style.borderRightStyle = "";
		newsContent[i].style.display = "none";
	}	
	newsContent[nTab].style.display = "block";
	tabs[nTab].className = "clsTabSelected";
	oTab = tabs[nextTab];
	if (oTab) oTab.style.borderLeftStyle = "none";
	oTab = tabs[prevTab];
	if (oTab) oTab.style.borderRightStyle = "none";
	// event.returnValue = false;
	return false;
}

var DocCookie = document.cookie;
var cName ;
var today = new Date();
var expiration = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);

function getCookie() {
	var index = DocCookie.indexOf(cName + "=");	
	if (index == -1) return '0';
	index = DocCookie.indexOf("=", index) + 1;
	var endstr = DocCookie.indexOf(";", index);
	if (endstr == -1) endstr = DocCookie.length;
	var ICookie = unescape(DocCookie.substring(index, endstr));
	if (ICookie == null || ICookie == "null" || ICookie == "" || ICookie.indexOf("undefined") >= 0 || ICookie.lastIndexOf("=") == ICookie.length - 1) {
		ICookie = '0';
	}
	return ICookie;
}

function iniTab(PageName){
   cName=PageName;    
   fnTabClick(getCookie());
}

function setCookie(Props) {
		document.cookie = cName + "=" + Props + "; path=/; expires=" + expiration.toGMTString()
		DocCookie = document.cookie;  	
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?