第一个函数
function showMenu(layerName)
{
// show the layer the user wants to see
eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'visible'");
}
function hiddenMenu(layerName)
{
// hidden the layer
eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'hidden'");
}
//第一个函数
第二个函数
function MM_showHideLayers()
{
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i if ((obj=MM_findObj(args[i]))!=null)
{
v=args[i+2];
if (obj.style)
{
obj=obj.style;
v=(v=='show')?'visible' v='hide')?'hidden':v;
}
obj.visibility=v;
}
}
function MM_findObj(n, d)
{
var p,i,x;
if(!d)
d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all)
x=d.all[n];
for (i=0;!x&&i x=d.forms[i][n];
for(i=0;!x&&d.layers&&i x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById)
x=document.getElementById(n);
return x;
}
//第二个函数
菜单
*{margin:0;padding:0;border:0;}
body {
background: #fff;
font-size: 14px;
font-family: "宋体";
}
#nav{
border:#FF0099 solid 3px;
position:absolute;
top:30px;
left:50px;
width:150px;
height:300px;
}
#ul {
position:absolute;
top:30px;
list-style-type:none;
line-height:24px;
background-color:#fff;
width:149px;
text-align:center;
float: none;
}
#ul a:link{
text-decoration:none;
line-height:24px;
color:#666;
text-align:center;
text-decoration:none;
display:block;
width:150px;
}
#ul a:visited{
line-height:24px;
color:#666;
text-align:center;
text-decoration:none;
display:block;
width:150px;
/*直设这个宽度就行*/
/*设置宽度,IE浏览器。虽然设置了block,但是还只是文字为超链接,所以得显式设置宽度*/
}
#ul a:hover {
text-decoration:none;
color:#FF2a84;
}
/*#ul li{
display:inline;/*IE会让LI上下有空白,去掉空白
}*/
/*水果层*/
#shui {
position:absolute;
left: 200px;
top: 50px;
border: #66FFCC solid;
height:210px;
border-width: 2px 2px 2px 18px;
text-align:center;
list-style-type:none;
line-height: 20px;
visibility: hidden;
background-color:#fff;/*不设背景色,层容易断裂 */
}
#shui a:link{
color: #666;
text-decoration: none;
display:block;
width:100px;/*不能用#nav a:link,a:visited,这样会找不到第二种,第二种不继承*/
}
#shui a:visited{
color: #666;
text-decoration: none;
display:block;
width:100px;/*不能用#nav a:link,a:visited,这样会找不到第二种,第二种不继承*/
}
#shui a:hover {
text-decoration:none;
color:#0cc;
}
#hua {
position:absolute;
left: 200px;
top: 55px;
border: #C06 solid;
height:170px;
border-width: 2px 2px 2px 18px;
text-align:center;
list-style-type:none;
line-height: 20px;
visibility: hidden;
background-color:#fff;
}
#hua a:link{
color: #666;
text-decoration: none;
display:block;
width:100px;
}
#hua a:visited{
color: #666;
text-decoration: none;
display:block;
width:100px;
}
#hua a:hover {
text-decoration:none;
color:#C06;
}
#che {
position: absolute;
left: 200px;
top: 60px;
border: #6c3 solid;
border-width: 2px 2px 2px 18px;
text-align:center;
list-style-type:none;
line-height: 20px;
visibility: hidden;
background-color:#fff;
}
#che a:link{
color: #666;
text-decoration: none;
display:block;
width:100px;
}
#che a:visited{
color: #666;
text-decoration: none;
display:block;
width:100px;
}
#che a:hover {
text-decoration:none;
color:#6c3;
}
-->
//判断浏览器
browser = navigator.appName;
browserNum = parseInt(navigator.appVersion);
if ((browser == "Netscape") && (browserNum {
// Netscape 4.x
layerRef = "document.layers['";
endLayerRef = "']";
styleRef = "";
}
else if ((browser == "Netscape") && (browserNum >= 5))
{
// Netscape 6
layerRef = "document.getElementById('";
styleRef = ".style";
endLayerRef = "')";
}
else
{
// Internet Explorer
layerRef = "document.all['";
endLayerRef = "']";
styleRef = ".style";
}
//第一个函数
function showMenu(layerName)
{
// show the layer the user wants to see
eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'visible'");
}
function hiddenMenu(layerName)
{
// hidden the layer
eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'hidden'");
}
//第一个函数
//第二个函数
function MM_showHideLayers()
{
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i if ((obj=MM_findObj(args[i]))!=null)
{
v=args[i+2];
if (obj.style)
{
obj=obj.style;
v=(v=='show')?'visible':(v='hide')?'hidden':v;
}
obj.visibility=v;
}
}
function MM_findObj(n, d)
{
var p,i,x;
if(!d)
d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all)
x=d.all[n];
for (i=0;!x&&i x=d.forms[i][n];
for(i=0;!x&&d.layers&&i x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById)
x=document.getElementById(n);
return x;
}
//第二个函数
查看更多关于css+div做的菜单_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did102244