当前位置: 代码迷 >> JavaScript >> ★怎样改变下拉菜单文字的颜色?该如何解决
  详细解决方案

★怎样改变下拉菜单文字的颜色?该如何解决

热度:502   发布时间:2012-02-04 15:43:09.0
★怎样改变下拉菜单文字的颜色??急
麻烦帮看下下面的代码,怎么改变文字的颜色?默认的是蓝色的 我想改成白色。试了很多种方法都没有办法改变颜色。大家帮帮我吧 谢谢了。
JScript code
//--------------- 主导航条内容 ------------//
var mainLayer=new Array("学院概况","学院新闻","党建工作","本科生教育","研究生教育","科学研究","学工展台","招生就业");//主导航栏目
var mainLayerHttp=new Array("college.asp","news.asp","part.asp","teach.asp","teach_two.asp","research.asp","student.asp","job.asp");//URL
 
//--------------- 次导航条内容 ------------//
var subLayer0=new Array("学院介绍","专业介绍","现任领导","师资队伍","学院机构"); //导航栏目一下的次级栏目
var subLayerHttp0=new Array("college.asp","collage.asp?vtitle=专业介绍","collage.asp?vtitle=现任领导","szdw.asp","collage.asp?vtitle=学院机构");//主导航栏目一下的次级栏目连接地址
var subLayer1=new Array("图片新闻","学院新闻","综合新闻"); //导航栏目一下的次级栏目
var subLayerHttp1=new Array("news.asp","list.asp?boardid=10&listid=25&name=学院新闻","list.asp?boardid=10&listid=53,26,45,53,52&name=综合新闻");//主导航栏目一下的次级栏目连接地址
var subLayer2=new Array("党建动态","入党须知");//导航栏目二的次级栏目
var subLayerHttp2=new Array("part.asp","list.asp?boardid=12&listid=48&name=入党须知");//主导航栏目二的次级栏目连接地址
var subLayer3=new Array("本科教学","实验中心","图书分馆"); //导航栏目三下的次级栏目
var subLayerHttp3=new Array("http://auto.whut.edu.cn/web/","http://auto.whut.edu.cn/center/","http://auto.whut.edu.cn/web/");//主导航栏目三下的次级栏目连接地址
var subLayer4=new Array("教务信息","导师简介","培养方案"); //导航栏目四下的次级栏目
var subLayerHttp4=new Array("list.asp?boardid=22&listid=90&name=教务信息","daoshi_list.htm","list.asp?boardid=22&listid=92,94&name=培养方案");//主导航栏目四下的次级栏目连接地址
var subLayer5=new Array("科研机构及动态","科研成果展示"); //导航栏目五下的次级栏目
var subLayerHttp5=new Array("list.asp?boardid=8&listid=31&name=科研机构","list.asp?boardid=8&listid=32&name=科研动态");//主导航栏目五下的次级栏目连接地址
var subLayer6=new Array("学工动态","学生团队","基地建设"); //导航栏目六下的次级栏目
var subLayerHttp6=new Array("student.asp","list.asp?boardid=11&listid=28&name=学生团队","list.asp?boardid=11&listid=29&name=基地建设");//主导航栏目六下的次级栏目连接地址
var subLayer7=new Array("学院招生","就业信息","职业规划和就业指导"); //导航栏目七下的次级栏目
var subLayerHttp7=new Array("job.asp","list.asp?boardid=9&listid=40&name=就业信息","list.asp?boardid=9&listid=95&name=职业规划和就业指导");//主导航栏目七下的次级栏目连接地址
 
//--------------- 主导航条Table参数调整 ------------//
var mainTableTdWidth=90; //每个TD的宽度,调整主导航内容间距
var mainTableBorder=0; //调整主导航表格边框宽度
var mainTableCellspacing=0; //调整主导航表格Cellspacing
var mainTableCellpadding=1; //调整主导航表格Cellpadding
var mainTableBgcolor="#ffffff"; //调整主导航表格背景色
var mainTableBordercolor=""; //调整主导航表格编框颜色
var mainTableBackgroundImg="images/link_bg_main.gif"; //调整主导航表格背景图片url地址
var hrefClassName="link" //调整url风格样式
var mainTableTdBgcolor=""; //调整主导航表格Td色
 
//--------------- 次导航条Table参数调整 ------------//
var subTableBorder=0; //调整次导航条表格边框宽度
var subTableCellspacing=0; //调整次导航条表格Cellspacing
var subTableCellpadding=0; //调整次导航条表格Cellpadding
var subTableBgcolor="#ffffff"; //调整次导航条表格背景色
var subTableBordercolor=""; //次导航条表格编框颜色
var subTableBackgroundImg=""; //次导航条表格背景图片url地址
var subTableTdBgcolor="#5B9DB9"; //调整次导航表格Td色
var sbuTabbleTop=15; //次导航表格上下微调
var sbuTabbleLeft=-1; //次导航表格左右微调
 
//--------------- 系统参数*请勿调整 ------------//
var layerMax=mainLayer.length+10;
var layerName="index";
 
//--------------- 生成下拉菜单 ------------//
function createMainLayer(){ 
document.write("<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><div id='wall'  style='position:relative; left:0px; top:0px; width:100%; z-index:1' ><table width=100% border='"+mainTableBorder+"' cellspacing='"+mainTableCellpadding+"' cellpadding='"+mainTableCellpadding+"' bgcolor='"+mainTableBgcolor+"' bordercolor='"+mainTableBordercolor+"' background='"+mainTableBackgroundImg+"'><tr>");
for(i=0;i<mainLayer.length;i++){
document.write("><td width='"+mainTableTdWidth+"' bgcolor='"+mainTableTdBgcolor+"' class='"+hrefClassName+"' onmouseover=layervib('visible','"+i+"')> <a href='"+mainLayerHttp[i]+"'>"+mainLayer[i]+"</a></td>");
}
document.write("</tr></table>");
 
for(j=0;j<mainLayer.length;j++){
createSubLayer(j);
}
document.write("></div></table></td></tr></table>");
}
 
 
//--------------- 生成每项下拉菜单内容 ------------//
function createSubLayer(num){
var subLayerName= layerName +num;
var subLayerLeft=(mainTableTdWidth*num)+mainTableCellpadding+mainTableBorder;
var subLayerList=eval("subLayer"+num);
var subLayerHttpList=eval("subLayerHttp"+num);
document.write("<div id='"+subLayerName+"' style='position:absolute; left:"+(subLayerLeft+sbuTabbleLeft)+"px; top:"+((mainTableBorder+mainTableCellspacing+mainTableCellpadding)*2+sbuTabbleTop)+"px; z-index:2; height: 24px; visibility: hidden'  >");
if(subLayerList.length!=0){
document.write("<table width='110px' border='"+subTableBorder+"' cellspacing='"+subTableCellpadding+"' cellpadding='"+subTableCellpadding+"' bgcolor='"+subTableBgcolor+"' bordercolor='"+subTableBordercolor+"' background='"+subTableBackgroundImg+"'") 
for(h=0;h<subLayerList.length;h++){ 
 
document.write("><tr><td bgcolor='"+subTableTdBgcolor+"' width='100%' class='link'> <a href='"+ subLayerHttpList [h]+"' class='link'>"+subLayerList[h]+"</a> </td></tr>");
}
document.write("</table>");
}
document.write("</div>"); 
 
}
 
//------------------------------次菜单显隐控制--------------------------//
function layervib(type,num){
var H=type;
var temp=(H='visible'?'hidden':'visible')
for(var i=0;i<mainLayer.length;i++){
var E=eval('document.all.index'+i+'.style');
var H=eval(i);
if(i==num){E.visibility=type}else{E.visibility=temp};
}
}