js/select.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// JavaScript Document
var ____configArray;
function __initDropDownList(configArray){
	//获取Select菜单
	____configArray=configArray;
	var existArray=configArray.split("|");
	for(var i=0;i<existArray.length;i++){
		if(existArray[i].length<1){return;}
		//根据参数分别获取div,并分别添加事件
		var parentContainer=document.getElementById(existArray[i]);
		if(!parentContainer){return;}
		//获取下面的select,且获取其中的option
		var selectObj=parentContainer.getElementsByTagName("select");
		if(selectObj.length<1){return;}
		var optionArray=selectObj[0].getElementsByTagName("option");
		//获取option,并分别添加到各个li
		var optionLength=optionArray.length;
		for(var j=0;j<optionLength;j++){
			//获取ul,以便能够添加项目
			var ulObj=parentContainer.getElementsByTagName("ul");
			if(ulObj.length<1){return;}
			//获取span,以便能显示当前选择的项目
			var spanObj=parentContainer.getElementsByTagName("span");
			if(spanObj.length<1){return;}
			var liObj=document.createElement("li");
			var textNode=document.createTextNode(optionArray[j].firstChild.nodeValue)
			liObj.appendChild(textNode);
			liObj.setAttribute("currentIndex",j);
            liObj.setAttribute('modid', optionArray[j].value);
			//给每个liObj添加事件
			liObj.onclick=function(){
				selectCurrentItem(this.parentNode,this);
			}
			liObj.onmouseover=function(){this.className="over";}
			liObj.onmouseout=function(){this.className="";}
			ulObj[0].appendChild(liObj);
			spanObj[0].onclick=function(event){
				//如果当前是显示的,就隐藏,反之亦然
				showHiddenUl(this);
			}
			spanObj[0].onmouseover=function(){this.className='over';}
			spanObj[0].onmouseout=function(){this.className="";};
			ulObj[0].onclick=function(){this.className="";}
		}
		parentContainer.onclick=function(event){
			if(!event){event=window.event;}
				//阻止事件冒泡
				event.cancelBubble=true;
				var eventUlObj=this.getElementsByTagName("ul")[0];
				bodyClickHiddenUl(eventUlObj);
		}
	}
}
function selectCurrentItem(ulObj,currentObj){
	var parentObj=ulObj.parentNode;
	var spanObj=parentObj.getElementsByTagName("span")[0];
	spanObj.firstChild.nodeValue=currentObj.firstChild.nodeValue;
	var selectObj=parentObj.getElementsByTagName("select")[0];
	selectObj.selectedIndex=parseInt(currentObj.getAttribute("currentIndex"));
    setModule(currentObj.firstChild.nodeValue, currentObj.getAttribute("modid"));
后面还有 41 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。