157、又一顶端下拉菜单 

        

157、又一顶端下拉菜单

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript">

<!-- Cross Browser NavBar (Not NS6)

MenuTitles=new Array()

SubMenuLinks=new Array()

function Rtrn(c){

if (document.layers) c.bgColor=HighLight;

if (document.all) c.style.background=HighLight;

}

function HghLght(c){

if (document.layers) c.bgColor=MenuBgColor;

if (document.all) c.style.background=MenuBgColor;

}

OpenLayer=(document.layers)?"<br><layer width=100% onMouseOver='HghLght(this)'; onMouseOut='Rtrn(this)'><center>":"<span style='width:100%' onMouseOver='HghLght(this)'; onMouseOut='Rtrn(this)'>";

CloseLayer=(document.layers)?'</center></layer>':'</span>';

 

/*************** Edit the appearance here ***************/

 

MenuWidth=(document.layers)?131/*NS width*/:131 /*IE width*/;

MenuFont='Arial';

MenuFontSize=2; //1 to 7 only!

MenuFontColor='ffffff';

MenuBgColor='8888ff';

HighLight='aaaaff';

Separater=1;

 

/********* Amount and Menu titles here. Add or delete as needed *********/

 

MenuTitles[0]='Example';

MenuTitles[1]='Menu 2';

MenuTitles[2]='Menu 3';

MenuTitles[3]='Menu 4';

MenuTitles[4]='Menu 5';

MenuTitles[5]='Menu 6';

 

SubMenuLinks[0]=""

+OpenLayer+"<a href='http://google.com/'>Search with Google</a>"+CloseLayer

+OpenLayer+"<a href='mailto:kurt.grigg@virgin.net'>Email me Here</a>"+CloseLayer

+OpenLayer+"<a href='someOtherPage.html'>My other Page</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

 

 

SubMenuLinks[1]=""

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

 

SubMenuLinks[2]=""

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

 

SubMenuLinks[3]=""

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

 

SubMenuLinks[4]=""

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

 

SubMenuLinks[5]=""

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

+OpenLayer+"<a href='#'>Your Links Here</a>"+CloseLayer

 

/****************** You don't need to alter anything past this point ******************/

 

 

Spacer=MenuWidth+Separater;

IniPos= -MenuWidth-Separater;

aSpacer=MenuWidth+Separater;

aIniPos= -MenuWidth-Separater;

MenuAmount=MenuTitles.length;

if (document.layers){

for (i=0; i < MenuAmount; i++){

document.write("<layer name='submenu"+i+"' top=0 left="+(aIniPos+=aSpacer)+" "

+"height=10 width="+MenuWidth+" bgcolor="+HighLight+" visibility=hide"

+" onMouseOver='this.visibility=\"show\"; var cd=this.id.length-1; var ab=this.id.charAt(cd); H(ab)' "

+" onMouseOut='this.visibility=\"hide\"; var ef=this.id.length-1; var gh=this.id.charAt(ef); B(gh)'>"

+"<center><font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"

+"&nbsp;<br>"+SubMenuLinks[i]+"<br></font></center></layer>");

}

for (i=0; i < MenuAmount; i++){

document.write("<layer name='nsmenu"+i+"' top=0 left="+(IniPos+=Spacer)+" height=0 "

+"width="+MenuWidth+" bgcolor="+MenuBgColor+" "

+"onMouseOver=\"this.bgColor=HighLight; var e=this.id.length-1; var d=this.id.charAt(e); On(d)\" "

+"onMouseOut=\"this.bgColor=MenuBgColor; var e=this.id.length-1; var d=this.id.charAt(e); Off(d)\">"

+"<center><font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"

+MenuTitles[i]+"</font></center></layer>");                                      

}

function On(x){

 for (i=0; i < MenuAmount; i++){

 document.layers['submenu'+x].visibility='show';

 }

}

function Off(x){

 for (i=0; i < MenuAmount; i++){

 document.layers['submenu'+x].visibility='hide';

 }

}

function B(y){

 for (i=0; i < MenuAmount; i++){

 document.layers['nsmenu'+y].bgColor=MenuBgColor;

 }

}

function H(y){

 for (i=0; i < MenuAmount; i++){

 document.layers['nsmenu'+y].bgColor=HighLight;

 }

}

}

if (document.all){

for (i=0; i < MenuAmount; i++){

document.write("<div id='sub"+i+"' style='position:absolute;"

+"top:0px;"

+"left:"+(aIniPos+=aSpacer)+";"

+"height:0px;"

+"width:"+MenuWidth+";"

+"background:"+HighLight+";"

+"visibility:hidden'"

+" onMouseOver='this.style.visibility=\"visible\";"

+" document.all[\"headers"+i+"\"].style.background=HighLight';"

+" onMouseOut='this.style.visibility=\"hidden\";"

+" document.all[\"headers"+i+"\"].style.background=MenuBgColor'>"

+"<center><font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"

+"&nbsp;<br>&nbsp;<br>"+SubMenuLinks[i]+"</font></center></div>");

}

for (i=0; i < MenuAmount; i++){

document.write("<div id='headers"+i+"' style='position:absolute;" 

+"top:0px;"

+"left:"+(IniPos+=Spacer)+";"

+"height:0px;"

+"width:"+MenuWidth+";"

+"background:"+MenuBgColor+";"

+"padding:0px'"

+" onMouseOver='document.all[\"sub"+i+"\"].style.visibility=\"visible\";"

+" this.style.background=HighLight'"

+" onMouseOut='document.all[\"sub"+i+"\"].style.visibility=\"hidden\";"

+" this.style.background=MenuBgColor'>"

+"<center><font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"

+MenuTitles[i]+"</font></center></div>");

}

}

//-->

</script>

 

Write a comment

Comments: 0