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

📄 actionlauncher.js

📁 java 写的一个新闻发布系统
💻 JS
字号:
	//--------------------------------------------------------------------------	// ActionLauncher CLass----------------------------------		// Class used to launch action for any resources that have	// a unique identifier (resource id) , an action url (engine url, javascript function,...).	// Each action has a name and the pair (resource id,action name) is used to 	// identify what action should be performed for a given resource.	//	// 	// @auhtor Khue Nguyen	//	//--------------------------------------------------------------------------    /**     * theResourceID	: id of the resource item     * theActionName 	: the action name     * theActionUrl 	: the actio url ( can be a url or javascript function )     */    function ActionItem (theResourceID,theActionName, theActionUrl){    	this.theResourceID 	= theResourceID;    	this.theActionName 	= theActionName;    	this.theActionUrl 	= theActionUrl;    	return this;    }        function ActionLauncher(){    	this.length = 0;		this.actions 					= new Array();		this.GetAction					= GetAction;		this.AddAction					= AddAction;		this.LaunchAction				= LaunchAction;		this.LaunchActionForSelectBox	= LaunchActionForSelectBox;		return this;	}	function GetAction(resourceID,actionName){			for ( var i=0 ; i<this.length ; i++ )		{			var theAction = this[i];				if ( (this[i].theResourceID == resourceID) && (this[i].theActionName == actionName) )			{				return theAction;			}		}		return null;	}	function AddAction(theResourceID,theActionName,theActionUrl)	{		this[this.length] = new ActionItem(theResourceID,theActionName,theActionUrl);		this.length++;	}	function LaunchAction(theResourceID,theActionName)	{		var theAction = this.GetAction(theResourceID,theActionName);		if ( theAction != null ){			eval(theAction.theActionUrl);		}	}	function LaunchActionForSelectBox(selectBox,actionName,multiple)	{		if ( selectBox == null ){			alert("Javascript element is not available");		} else if ( selectBox.selectedIndex == -1 ){			alert("At least one item must be selected");		} else if (multiple == "true") {			// look for the first action of this action name found for this resource			// action of this type typically consist of a form submit with multiple values handling.			this.LaunchAction(selectBox.options[selectBox.selectedIndex].value,actionName);		} else {			// check if several options are selected			firstSelected = -1;			nbSel = 0;			for ( i=0 ;i<selectBox.options.length; i++ ){				if ( selectBox.options[i].selected ){					if ( firstSelected == -1 ){						firstSelected = i;					}					nbSel += 1;				}				if ( nbSel > 1 ){					break;				}			}				if ( nbSel > 1 ){				alert("This function only applies to one item at a time.");				// deselect all				selectBox.selectedIndex = -1;				// reselect only the first				selectBox.selectedIndex = firstSelected;			} else {				this.LaunchAction(selectBox.options[selectBox.selectedIndex].value,actionName);			}		}	}			// End ActionLauncher CLass-----------------------------------------		//--------------------------------------------------------------------------

⌨️ 快捷键说明

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