public.js

来自「J-Blog v1.0 系统配置: web.xml里默认配置为:resin」· JavaScript 代码 · 共 188 行

JS
188
字号

var _private_Login_Status = false;

function hideLayer()
{
	if (document.getElementById)
	{
		oElement = document.getElementById("ie");
	}else if (document.all){
		oElement = document.all("ie");

	}else if (document.layers){
		oElement = document.layers["ns"];
	}
	if (oElement != null && document.layers)
	{
		oElement.visibility = "hidden";
	}else if (oElement != null){
		oElement.style.visibility = "hidden";
	}
}

function resizeHeight(oElementByName,oToolHeight)
{
	var clientHeight = document.body.clientHeight;
	this.oElementByName = oElementByName?oElementByName:"eachitem";
	this.oToolHeight = oToolHeight?oToolHeight:30;

	if (document.body.clientHeight > this.oToolHeight)
	{
		try {
			document.getElementById(this.oElementByName).height = parseInt(clientHeight - this.oToolHeight);
		}catch(e){;}
	}
}

function request(QueryString,strHref)
{
	var strParameter;
	strHref = strHref?strHref:window.location.href;

	if(strHref.search(/\?/)!=-1)
	{
		strHref=strHref.substr(strHref.search(/\?/)+1);
		strHref=strHref.split(/&/);
		for(var i = 0; i<strHref.length; i++)
		{
			if(strHref[i].search("^"+QueryString+"=")!=-1)
			{
				strParameter=strHref[i].substr(QueryString.length+1)
			}
		}
		
		return(strParameter);
	}
}

function checkBoxALL(oForm,object,oSelect,oviewType)
{
	var displayValue;
	var num = 0;
	this.oviewType = oviewType?oviewType:"normal";
	
	if (object.name == oSelect)
	{
		for (var i=0;i<oForm.elements.length;i++)
		{
			var e = oForm.elements[i];
			if (e.type == "checkbox")
			{
				if ((e.name != oSelect) && (e.name != "status"))
				{
					if (object.checked)
					{
						e.checked = true;
						displayValue = "block";
					}else{
						e.checked = false;
						displayValue = "none";
					}

					if (this.oviewType == "view")
					{
						eval(oSelect+"_inner").style.display = "block";
					}else if (this.oviewType == "noview"){
						eval(oSelect+"_inner").style.display = "none";
					}else{
						eval(oSelect+"_inner").style.display = displayValue;
					}
				}
			}
		}
	}else{
		if (object.checked)
		{
			object.checked = true;
			eval(oSelect+"_inner").style.display = "block";
		}else{

			object.checked = false;

			for (var i=0;i<oForm.elements.length;i++)
			{
				var e = oForm.elements[i];
				if (e.type == "checkbox")
				{
					if ((e.name != oSelect) && (e.name != "status") && (e.checked))
					{
						num += 1;
					}
				}
			}
			
			if (num == 0)
			{
				eval(oSelect+"_inner").style.display = "none";
			}
		}
	}
	num = 0;
}

function HTMLEncode(text)
{
	if ( typeof( text ) != "string" )
		text = text.toString() ;

	text = text.replace(/&/g, "&amp;") ;
	text = text.replace(/"/g, "&quot;") ;
	text = text.replace(/</g, "&lt;") ;
	text = text.replace(/>/g, "&gt;") ;
	text = text.replace(/'/g, "&#39;") ;
	text = text.replace(/\\n/g, "\n") ;
	text = text.replace(/\\r/g, "\r") ;

	return text ;
}

function IIf(strParameter,blTrue,blFalse)
{
	this.blTrue = blTrue?blTrue:true;
	this.blFalse = blFalse?blFalse:false;
	
	if (strParameter)
	{
		return (blTrue);
	}else{
		return (blFalse);
	}
}

function object_root()
{
	this.parameter;
	this.path;

	this.InitializeRootVirtualPath = function()
	{
		var thisUrl = window.location.href.toString();
		var arrUrlParams = this.parameter.split(",");

		for (var i = 0;i <= arrUrlParams.length ; i++ )
		{
			if (thisUrl.indexOf(arrUrlParams[i]) > 0)
			{
				thisUrl = thisUrl.substring(0,thisUrl.indexOf(arrUrlParams[i]));
				break;
			}

			if (i == arrUrlParams.length)
			{
				thisUrl = thisUrl.substring(0,thisUrl.lastIndexOf("/")+1);

				if (thisUrl.length = 0)
				{
					thisUrl = thisUrl.substring(0,thisUrl.lastIndexOf("\\")+1);
				}
				break;
			}
		}

		this.path = thisUrl;
	}
}

var root = new object_root();
root.parameter = "images,style,script";
root.InitializeRootVirtualPath()

⌨️ 快捷键说明

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