⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.v1.3.4.js

📁 一个真正的CMS系统,可以完全实现建站自动化,用.NET开发.
💻 JS
📖 第 1 页 / 共 2 页
字号:
//JavaScript Ver 1.3.4

String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};
String.prototype.nl2br=function(){return this.split("\n").join("<br />\n");};
//JavaScript End

//DHTML Start
var writeDebug=function(){};

var _get = function(id)
{
	return document.getElementById(id);
};

var _goto = function(url)
{
	window.location.href = url;
};

function _refresh() { window.location.reload( false );}

var _decorate=function()
{
	var el=arguments[0];
	if(!el)
	{
		return;
	}
	arguments[0]=el;
	var _154="decorate_"+el.className;
	if(window[_154])
	{
		return window[_154](arguments);
	}
	writeDebug(_154+" is not a function");
};

function _isNull(obj){
	if (typeof(obj) == "undefined")
	  return true;
	  
	if (obj == undefined)
	  return true;
	  
	if (obj == null)
	  return true;
	 
	return false;
}

function _help(sHelpID)
{
	var oHelp = _get(sHelpID);
	if (oHelp != null)
	{
		if (oHelp.style.display == 'none')
			oHelp.style.display = '';
		else
			oHelp.style.display = 'none';

		return true;	//cancel postback
	}
	return false;	//failed so do postback
}

function _checkFormAll(isChecked)
{
	if (!_isNull(document.forms)){
		var form = document.forms[0];
		if (!_isNull(form)){
			for(var i=0; i<form.elements.length; i++)
			{
				if (form.elements[i].type=="checkbox")
				{
					form.elements[i].checked = isChecked;
				}
			}
		}
	}
}

function _getCheckBoxCollectionValue(checklist){
	var retval = new String("");
	if (!_isNull(checklist)){
		if (_isNull(checklist.length)){
			if(checklist.checked){
				retval = checklist.value + '';
			}
		}else{
			var hasValue = false;
			for (var i = 0; i < checklist.length; i++){
				if(checklist[i].checked){
					hasValue = true;
					retval += checklist[i].value + ',';
				}
			}
			if (hasValue){
				retval = retval.substring(0, retval.length - 1);
			}
		}
	}
	return retval;
}

function _alertCheckBoxCollection(checklist, alertString){
	var collectionValue = _getCheckBoxCollectionValue(checklist);
	if (collectionValue.length == 0){
		alert(alertString);
		return true;
	}
	return false;
}

function _showImage(obj, imageID){
	if(obj.value=="") return false;
	if(obj.value.search(/\.jpg|\.jpeg|\.bmp|\.gif|\.emf|\.wmf|\.xbm|\.png$/i) == -1) {
		alert("图片文件格式不正确");
		return false;
	}
	var prev=document.getElementById(imageID);
	prev.src=obj.value;
}

function _collapseElementByID(elementID){
	var oObject = document.all.item(elementID);
	if (!_isNull(oObject)){
	   if (oObject.length != null){
		  for (i = 0; i < oObject.length; i++){
			 if(oObject(i).style.display == "") {
			 	oObject(i).style.display = "none";
			 }else{
			 	oObject(i).style.display = "";
			 }
		  }
	   }
	   else{
			 if(oObject.style.display == "") {
			 	oObject.style.display = "none";
			 }else{
			 	oObject.style.display = "";
			 }
	   }
	}
}

function _toggleVisible(targetID, image, imageUrl, imageCollapsedUrl)
{
	target = _get(targetID);
	try {
			Effect.toggle(targetID,'slide',{duration: 0.5});
		} catch (e) {
			if (target.style.display == "none") {
				target.style.display = "";
			} else {
				target.style.display = "none";
			}
		}
	
	if (!_isNull(imageCollapsedUrl) && imageCollapsedUrl != "") {
		if (target.style.display == "none") {
			image.src = imageCollapsedUrl;
		} else {
			image.src = imageUrl;
		}
	}
	return false;
}

//DHTML End

//Ajax Start

function highlight(div)
{
	if(div.hideTimer)
	{
		clearTimeout(div.hideTimer);
	}
	div.style.color="gray";
	div.style.backgroundColor="#ffffd3";
}

function unhighlight(div)
{
	if(div.hideTimer)
	{
		clearTimeout(div.hideTimer);
	}
	div.hideTimer=setTimeout("var el = document.getElementById(\""+div.id+"\"); if (el) unhighlight2(el)",500);
}

function unhighlight2(div)
{
	if(div.hideTimer)
	{
		clearTimeout(div.hideTimer);
	}
	div.style.color="";
	div.style.backgroundColor="";
}

/* Ajax */

function Ajax_RefreshWhenResponseIsTrue(originalRequest)
{
	var xmlDoc = originalRequest.responseXML.documentElement;
	var theText = xmlDoc.text;
	if(theText == 'true')
	{
		_refresh();
	}
	else
	{
		alert('Error');
	}
}

function Ajax_GetXMLHttpRequest() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else {
		if (window.Ajax_XMLHttpRequestProgID) {
			return new ActiveXObject(window.Ajax_XMLHttpRequestProgID);
		} else {
			var progIDs = ["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
			for (var i = 0; i < progIDs.length; ++i) {
				var progID = progIDs[i];
				try {
					var x = new ActiveXObject(progID);
					window.Ajax_XMLHttpRequestProgID = progID;
					return x;
				} catch (e) {

⌨️ 快捷键说明

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