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

📄 dropmenu.js

📁 ARCGIS程序,可以实现查、缩放等功能
💻 JS
📖 第 1 页 / 共 2 页
字号:
			if(SubTp+CCH>TpScrlld+ScWinHght)SubTp=this.Level==1?SubTp=TpScrlld+ScWinHght-CCH:SubTp-CCH+(1-2*ChildVerticalOverlap)*ThisHt;
			if(SubTp<TpScrlld)SubTp=TpScrlld;
		}
		ChCntTL.top=SubTp;ChCntTL.left=SubLt;ChCntTL.visibility=M_Show;
	}
	status=this.LinkTxt;
}

function OpenMenuClick(){
	if(!Loadd||!Creatd) return;
	var HP=Nav4?this.LowLyr:this;
	CurrntOvr=this;
	IniFlg=0;
	if(this.Container.Level==1){
		var Cntnr=document.LastCntnr;
		while(Cntnr!=null){
			ClearAllChilds(Cntnr.FrstMbr);
			Cntnr=Cntnr.Pre;
		}
	}else{
		ClearAllChilds(this.Container.FrstMbr);
	}
	HiliteItem(HP);
	status=this.LinkTxt;
}

function CloseMenu(){
	if(!Loadd||!Creatd) return;
	if(!KeepHilite){
		var HP=Nav4?this.LowLyr:this;
		LowItem(HP);
	}
	status='';
	if(this==CurrntOvr){
		IniFlg=1;
		if(CloseTmr)clearTimeout(CloseTmr);
		CloseTmr=setTimeout('Initiate(CurrntOvr)',DissapearDelay);
	}
}

function CntnrSetUp(Wdth,Hght,NoOff){
	var x=RcrsLvl==1?BorderColor:BorderSubColor;
	this.FrstMbr=null;
	this.OrgLeft=this.OrgTop=0;
	if(x)this.bgColor=x;
	if(Nav4){	
		this.visibility='hide';
		this.resizeTo(Wdth,Hght);
	}
	else{	
		if(x)this.style.backgroundColor=x;
		this.style.width=Wdth;
		this.style.height=Hght;
		this.style.fontFamily=FontFamily;
		this.style.fontWeight=FontBold?'bold':'normal';
		this.style.fontStyle=FontItalic?'italic':'normal';
		this.style.fontSize=FontSize+'pt';
		this.style.zIndex=RcrsLvl+Ztop
	}
}

function MbrSetUp(MmbrCntnr,PrMmbr,WhatMenu,Wdth,Hght){
	var Location=RcrsLvl==1?FrstLoc:ScLoc;
	var MemVal=eval(WhatMenu+'[0]');
	var t,T,L,W,H,S;
	var a,b,c,d;
	this.PrvMbr=PrMmbr;
	this.Level=RcrsLvl;
	this.LinkTxt=eval(WhatMenu+'[1]');
	this.Container=MmbrCntnr;
	this.ChildCntnr=null;
	this.Hilite=0;
	this.style.overflow='hidden';
	this.style.cursor=ExpYes&&(this.LinkTxt||(RcrsLvl==1&&UnfoldsOnClick))?'hand':'default';
	this.ro=0;
	if(MemVal.indexOf('rollover')!=-1){
		this.ro=1;
		this.ri1=MemVal.substring(MemVal.indexOf(':')+1,MemVal.lastIndexOf(':'));
		this.ri2=MemVal.substring(MemVal.lastIndexOf(':')+1,MemVal.length);
		this.rid=WhatMenu+'i';MemVal="<img src='../../../../pageComponent/resources/scripts/menu/"+this.ri1+"' name='"+this.rid+"'>";
	}
	this.value=MemVal;

	if(RcrsLvl==1){
		a=LowBgColor;
		b=HighBgColor;
		c=FontLowColor;
		d=FontHighColor;
	}
	else{	
		a=LowSubBgColor;
		b=HighSubBgColor;
		c=FontSubLowColor;
		d=FontSubHighColor;
	}

	var eles = document.getElementsByName("hciTopMenuPath");
	if( eles.length>0 ){
		var hciTopMenuPath=eles[0].value;
		if( this.Level==1 && MemVal==hciTopMenuPath && hciTopMenuPath!="" ){
			a=SelectColor;
		}
	}

	this.LoBck=a;
	this.LwFntClr=c;
	this.HiBck=b;
	this.HiFntClr=d;
	this.style.color=this.LwFntClr;
	if(this.LoBck)this.style.backgroundColor=this.LoBck;
	this.style.textAlign=MenuTextCentered;
	if(eval(WhatMenu+'[2]'))this.style.backgroundImage="url(\'"+eval(WhatMenu+'[2]')+"\')";
	if(MemVal.indexOf('<')==-1){
		this.style.width=Wdth-LftXtra;
		this.style.height=Hght-TpXtra;
		this.style.paddingLeft=LeftPaddng;
		this.style.paddingTop=TopPaddng;
	}
	else{	
		this.style.width=Wdth;
		this.style.height=Hght;
	}

	if(MemVal.indexOf('<')==-1&&DomYes){
		t=Location.document.createTextNode(MemVal);
		this.appendChild(t);
	}
	else this.innerHTML=MemVal;

	if(eval(WhatMenu+'[3]')&&ShowArrow){
		a=RcrsLvl==1&&FirstLineHorizontal?3:RightToLeft?6:0;
		S=Arrws[a];
		W=Arrws[a+1];
		H=Arrws[a+2];
		T=RcrsLvl==1&&FirstLineHorizontal?Hght-H-2:(Hght-H)/2;
		L=RightToLeft?2:Wdth-W-2;
		if(DomYes){
			t=Location.document.createElement('img');
			this.appendChild(t);
			t.style.position='absolute';
			t.src=S;
			t.style.width=W;
			t.style.height=H;
			t.style.top=T;
			t.style.left=L;
		}
		else{	

			MemVal+="<div style='position:absolute; top:"+T+"; left:"+L+"; width:"+W+"; height:"+H+";visibility:inherit'><img src='../../../../pageComponent/resources/scripts/menu/"+S+"'></div>";
			this.innerHTML=MemVal;
		}
	}
	if(ExpYes){
		this.onselectstart=CnclSlct;
		this.onmouseover=RcrsLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;
		this.onmouseout=CloseMenu;
		this.onclick=RcrsLvl==1&&UnfoldsOnClick&&eval(WhatMenu+'[3]')?OpenMenu:GoTo;
	}
	else{	
		RcrsLvl==1&&UnfoldsOnClick?this.addEventListener('mouseover',OpenMenuClick,false):this.addEventListener('mouseover',OpenMenu,false);
		this.addEventListener('mouseout',CloseMenu,false);
		RcrsLvl==1&&UnfoldsOnClick&&eval(WhatMenu+'[3]')?this.addEventListener('click',OpenMenu,false):this.addEventListener('click',GoTo,false);
	}

}

function NavMbrSetUp(MmbrCntnr,PrMmbr,WhatMenu,Wdth,Hght){
	var a,b,c,d;
	if(RcrsLvl==1){
		a=LowBgColor;
		b=HighBgColor;
		c=FontLowColor;
		d=FontHighColor;
	}
	else {	
		a=LowSubBgColor;
		b=HighSubBgColor;
		c=FontSubLowColor;
		d=FontSubHighColor;
	}
	this.value=eval(WhatMenu+'[0]');
	this.ro=0;
	if(this.value.indexOf('rollover')!=-1){
		this.ro=1;
		this.ri1=this.value.substring(this.value.indexOf(':')+1,this.value.lastIndexOf(':'));
		this.ri2=this.value.substring(this.value.lastIndexOf(':')+1,this.value.length);
		this.rid=WhatMenu+'i';this.value="<img src='../../../../pageComponent/resources/scripts/menu/"+this.ri1+"' name='"+this.rid+"'>";
	}
	if(LeftPaddng&&this.value.indexOf('<')==-1&&MenuTextCentered=='left')this.value='&nbsp\;'+this.value;
	if(FontBold)this.value=this.value.bold();
	if(FontItalic)this.value=this.value.italics();
	this.Ovalue=this.value;
	this.value=this.value.fontcolor(c);
	this.Ovalue=this.Ovalue.fontcolor(d);
	this.value=CntrTxt+"<font face='"+FontFamily+"' point-size='"+FontSize+"'>"+this.value+TxtClose;
	this.Ovalue=CntrTxt+"<font face='"+FontFamily+"' point-size='"+FontSize+"'>"+this.Ovalue+TxtClose;
	this.LoBck=a;
	this.HiBck=b;
	this.ChildCntnr=null;
	this.PrvMbr=PrMmbr;
	this.Hilite=0;
	this.visibility='inherit';
	if(this.LoBck)this.bgColor=this.LoBck;
	this.resizeTo(Wdth,Hght);
	if(!AcrssFrms&&eval(WhatMenu+'[2]'))this.background.src=eval(WhatMenu+'[2]');
	this.document.write(this.value);
	this.document.close();
	this.CmdLyr=new Layer(Wdth,MmbrCntnr);
	this.CmdLyr.Level=RcrsLvl;
	this.CmdLyr.LinkTxt=eval(WhatMenu+'[1]');
	this.CmdLyr.visibility='inherit';
	this.CmdLyr.onmouseover=RcrsLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;
	this.CmdLyr.onmouseout=CloseMenu;
	this.CmdLyr.captureEvents(Event.MOUSEUP);
	this.CmdLyr.onmouseup=RcrsLvl==1&&UnfoldsOnClick&&eval(WhatMenu+'[3]')?OpenMenu:GoTo;
	this.CmdLyr.LowLyr=this;
	this.CmdLyr.resizeTo(Wdth,Hght);
	this.CmdLyr.Container=MmbrCntnr;
	if(eval(WhatMenu+'[3]')&&ShowArrow){
		a=RcrsLvl==1&&FirstLineHorizontal?3:RightToLeft?6:0;
		this.CmdLyr.ImgLyr=new Layer(Arrws[a+1],this.CmdLyr);
		this.CmdLyr.ImgLyr.visibility='inherit';
		this.CmdLyr.ImgLyr.top=RcrsLvl==1&&FirstLineHorizontal?Hght-Arrws[a+2]-2:(Hght-Arrws[a+2])/2;
		this.CmdLyr.ImgLyr.left=RightToLeft?2:Wdth-Arrws[a+1]-2;
		this.CmdLyr.ImgLyr.width=Arrws[a+1];
		this.CmdLyr.ImgLyr.height=Arrws[a+2];
		ImgStr="<img src='../../../../pageComponent/resources/scripts/menu/"+Arrws[a]+"' width='"+Arrws[a+1]+"' height='"+Arrws[a+2]+"'>";
		this.CmdLyr.ImgLyr.document.write(ImgStr);
		this.CmdLyr.ImgLyr.document.close();
	}
}

function CreateMenuStructure(MName,NumberOf,Start){
	RcrsLvl++;
	var i,NoOffSubs,Mbr,Wdth=0,Hght=0;
	var PrvMmbr=null;
	var WMnu=MName+'1';
	var MenuWidth=eval(WMnu+'[5]');
	var MenuHeight=eval(WMnu+'[4]');
	var Location=RcrsLvl==1?FrstLoc:ScLoc;
	if (RcrsLvl==1&&FirstLineHorizontal){
		//modify begin
		if(Start==0){
			for(i=1;i<NumberOf+1;i++){
				WMnu=MName+eval(i);
				Wdth=eval(WMnu+'[5]')?Wdth+eval(WMnu+'[5]'):Wdth+MenuWidth;
			}
			Wdth=BorderBtwnElmnts?Wdth+(NumberOf+1)*BorderWidth:Wdth+2*BorderWidth;
		}else{
			if((Start+MenuLineCount)>(NumberOf+1)){
				for(i=Start;i<NumberOf+1;i++){
					WMnu=MName+eval(i);
					Wdth=eval(WMnu+'[5]')?Wdth+eval(WMnu+'[5]'):Wdth+MenuWidth;
				}
				Wdth=BorderBtwnElmnts?Wdth+(NumberOf-Start+2)*BorderWidth:Wdth+2*BorderWidth;
			}
			else{
				for(i=1;i<MenuLineCount+1;i++){
					WMnu=MName+eval(i);
					Wdth=eval(WMnu+'[5]')?Wdth+eval(WMnu+'[5]'):Wdth+MenuWidth;
				}
				Wdth=BorderBtwnElmnts?Wdth+(MenuLineCount+1)*BorderWidth:Wdth+2*BorderWidth;
			}
		}
		//end modify
		Hght=MenuHeight+2*BorderWidth;
	}
	else{	
		for(i=1;i<NumberOf+1;i++){
			WMnu=MName+eval(i);
			Hght=eval(WMnu+'[4]')?Hght+eval(WMnu+'[4]'):Hght+MenuHeight;
		}
		Hght=BorderBtwnElmnts?Hght+(NumberOf+1)*BorderWidth:Hght+2*BorderWidth;
		Wdth=MenuWidth+2*BorderWidth;
	}

	if(DomYes){
		var MmbrCntnr=Location.document.createElement("div");
		MmbrCntnr.style.position='absolute';
		MmbrCntnr.style.visibility='hidden';
		if(Start!=0){
			MmbrCntnr.style.top=((Start-1)/MenuLineCount)*Hght;
		}
		Location.document.body.appendChild(MmbrCntnr);
	}
	else{	

		if(Nav4) 
			var MmbrCntnr=new Layer(Wdth,Location);
		else{	
			WMnu+='c';
			Location.document.body.insertAdjacentHTML("AfterBegin","<div id='"+WMnu+"' style='visibility:hidden; position:absolute;'><\/div>");
			var MmbrCntnr=Location.document.all[WMnu];
		}
	}
	MmbrCntnr.SetUp=CntnrSetUp;
	MmbrCntnr.SetUp(Wdth,Hght,NumberOf);

	if(Exp4){	
		MmbrCntnr.InnerString='';
		for(i=1;i<NumberOf+1;i++){
			WMnu=MName+eval(i);
			MmbrCntnr.InnerString+="<div id='"+WMnu+"' style='position:absolute;'><\/div>";
		}
		MmbrCntnr.innerHTML=MmbrCntnr.InnerString;	
	}

	if(Start==0){
		for(i=1;i<NumberOf+1;i++){
			WMnu=MName+eval(i);
			NoOffSubs=eval(WMnu+'[3]');
			Wdth=RcrsLvl==1&&FirstLineHorizontal?eval(WMnu+'[5]')?eval(WMnu+'[5]'):MenuWidth:MenuWidth;
			Hght=RcrsLvl==1&&FirstLineHorizontal?MenuHeight:eval(WMnu+'[4]')?eval(WMnu+'[4]'):MenuHeight;
			if(DomYes){
				Mbr=Location.document.createElement("div");
				Mbr.style.position='absolute';
				Mbr.style.visibility='inherit';
				MmbrCntnr.appendChild(Mbr);
			}
			else Mbr=Nav4?new Layer(Wdth,MmbrCntnr):Location.document.all[WMnu];
			Mbr.SetUp=Nav4?NavMbrSetUp:MbrSetUp;
			Mbr.SetUp(MmbrCntnr,PrvMmbr,WMnu,Wdth,Hght);

			if(NoOffSubs) Mbr.ChildCntnr=CreateMenuStructure(WMnu+'_',NoOffSubs,0);
			PrvMmbr=Mbr;
		}
	}
	else{
		var End;
		if((Start+MenuLineCount)>NumberOf){
			End=NumberOf+1;
		}else{
			End=Start+MenuLineCount;
		}

		for(i=Start;i<End;i++){
			WMnu=MName+eval(i);
			NoOffSubs=eval(WMnu+'[3]');
			Wdth=RcrsLvl==1&&FirstLineHorizontal?eval(WMnu+'[5]')?eval(WMnu+'[5]'):MenuWidth:MenuWidth;
			Hght=RcrsLvl==1&&FirstLineHorizontal?MenuHeight:eval(WMnu+'[4]')?eval(WMnu+'[4]'):MenuHeight;
			if(DomYes){
				Mbr=Location.document.createElement("div");
				Mbr.style.position='absolute';
				Mbr.style.visibility='inherit';
				MmbrCntnr.appendChild(Mbr);
			}
			else Mbr=Nav4?new Layer(Wdth,MmbrCntnr):Location.document.all[WMnu];
			Mbr.SetUp=Nav4?NavMbrSetUp:MbrSetUp;
			Mbr.SetUp(MmbrCntnr,PrvMmbr,WMnu,Wdth,Hght);
			if(NoOffSubs) Mbr.ChildCntnr=CreateMenuStructure(WMnu+'_',NoOffSubs,0);
			PrvMmbr=Mbr;
		}
		
	}
	MmbrCntnr.FrstMbr=Mbr;
	RcrsLvl--;
	return(MmbrCntnr);
}

function CreateMenuStructureAgain(MName,NumberOf){
	var i,WMnu,NoOffSubs,PrvMmbr,Mbr=FrstCntnr.FrstMbr;
	RcrsLvl++;
	for(i=NumberOf;i>0;i--){
		WMnu=MName+eval(i);
		NoOffSubs=eval(WMnu+'[3]');
		PrvMmbr=Mbr;
		if(NoOffSubs)Mbr.ChildCntnr=CreateMenuStructure(WMnu+'_',NoOffSubs);
		Mbr=Mbr.PrvMbr;
	}
	RcrsLvl--;
}

function wirte_file(str) {	
	var fso = new ActiveXObject("Scripting.FileSystemObject");
	var f = fso.OpenTextFile(FileName,8,true);
	f.Write(str);
	f.Close();
}

function ShowSelect(Doc,bVisible){
	var selects=document.getElementsByTagName("select");
	for(var i=0; i<selects.length; i++){
	    if (selects[i].name != 'tbSelYear' && selects[i].name != 'tbSelMonth') {
		    selects[i].style.visibility = bVisible?"visible":"hidden";
		}
	}
	var iframes=Doc.getElementsByTagName("iframe");
	for(var i=0;i<iframes.length;i++){
		var selects = Doc.frames(iframes[i].name).document.getElementsByTagName("select");
		for(var j=0;j<selects.length;j++){
    	    if (selects[j].name != 'tbSelYear' && selects[j].name != 'tbSelMonth') {
    			selects[j].style.visibility=bVisible?"visible":"hidden";
    		}
		}
		ShowSelect(Doc.frames(iframes[i].name).document,bVisible);
	}	
}

function SetSubPath(Level,Value){
	SubPathNum = Level;
	switch(SubPathNum)
	{
		case 2: window.second	= Value;break;
		case 3: window.third	= Value;break;
		case 4: window.four		= Value;break;
		case 5: window.fifth	= Value;break;
		case 6: window.sixth	= Value;break;
		case 7: window.seventh	= Value;break;
	}
}

function SaveSubPath(){
	switch(SubPathNum)
	{
		case 2: document.total	= window.first + "→" + window.second;break;
		case 3: document.total	= window.first + "→" + window.second + "→" + window.third;break;
		case 4: document.total	= window.first + "→" + window.second + "→" + window.third + "→" + window.four;break;
		case 5: document.total	= window.first + "→" + window.second + "→" + window.third + "→" + window.four + "→" + window.fifth;break;
		case 6: document.total	= window.first + "→" + window.second + "→" + window.third + "→" + window.four + "→" + window.fifth + "→" + window.sixth;break;
		case 7: document.total	= window.first + "→" + window.second + "→" + window.third + "→" + window.four + "→" + window.fifth + "→" + window.sixth + "→" + window.seventh;break;
		default:document.total	= window.first;		  						   												  						  
	}
	if(SubPathNum>0)
	{
		SetCookie("hciCurMenuPath",document.total);
		SetCookie("hciTopMenuPath",window.first);		
	}
}

function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return "";
}

function SetCookie(sName, sValue)
{	
	document.cookie = sName + "=" + escape(sValue) ;
}

function DelCookie(sName)
{
	var sValue=GetCookie(sName);

	if( sValue!="" )
	{
		date = new Date();
		document.cookie = sName + "=" + escape(sValue) + "; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
	}
}

⌨️ 快捷键说明

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