| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 470 人关注过本帖
标题:一个关于三家菜单的问题!
只看楼主 加入收藏
思轩
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-12-27
收藏
 问题点数:0 回复次数:2 
一个关于三家菜单的问题!

那位大虾能帮一下小弟!我看了一天的代码!但是还是达不到我想要的效果!我是关于菜单制作的问题!我上网拷贝别人的代码,如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<script>
if (!document.getElementById)
document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
var menu = document.getElementById(menuId);
var actuator = document.getElementById(actuatorId);

if (menu == null || actuator == null) return;

//if (window.opera) return; // I'm too tired

actuator.parentNode.style.backgroundImage = "url(/images/plus.gif)";
actuator.onclick = function() {
var display = menu.style.display;
this.parentNode.style.backgroundImage =
(display == "block") ? "url(/images/plus.gif)" : "url(/images/minus.gif)";
menu.style.display = (display == "block") ? "none" : "block";

return false;
}
}
window.onload = function() {
initializeMenu("productsMenu", "productsActuator");
initializeMenu("newPhonesMenu", "newPhonesActuator");
initializeMenu("compareMenu", "compareActuator");
}
</script>
<style>
body {
font-family: verdana, helvetica, arial, sans-serif;
}

#mainMenu {
background-color: #EEE;
border: 1px solid #CCC;
color: #000;
width: 203px;
}

#menuList {
margin: 0px;
padding: 10px 0px 10px 15px;
}

li.menubar {
background: url(/images/plus.gif) no-repeat 0em 0.3em;
font-size: 12px;
line-height: 1.5em;
list-style: none outside;
}

.menu, .submenu {
display: none;
margin-left: 15px;
padding: 0px;
}

.menu li, .submenu li {
background: url(/images/square.gif) no-repeat 0em 0.3em;
list-style: none outside;
}

a.actuator {
background-color: transparent;
color: #000;
font-size: 12px;
padding-left: 15px;
text-decoration: none;
}

a.actuator:hover {
text-decoration: underline;
}

.menu li a, .submenu li a {
background-color: transparent;
color: #000;
font-size: 12px;
padding-left: 15px;
text-decoration: none;
}

.menu li a:hover, submenu li a:hover {
/*border-bottom: 1px dashed #000;*/
text-decoration: underline;
}

span.key {
text-decoration: underline;
}
</style>
</head>
<body>
<div id="mainMenu">
<ul id="menuList">
<li class="menubar">
<a href="#" id="productsActuator" class="actuator">图秀地带收藏夹</a>
<ul id="productsMenu" class="menu">
<li>
<a href="#" id="newPhonesActuator" class="actuator">我的好友</a>
<ul id="newPhonesMenu" class="submenu">
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
</ul>
</li>
<li>
<a href="#" id="compareActuator" class="actuator">陌生人</a>
<ul id="compareMenu" class="submenu">
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</body>
</BODY>
</HTML>
在一个页面就能达到效果,但是我想在同一个页面显示两个内容,但是第二个就打不开二级和三级的子菜单!代码是:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<script>
if (!document.getElementById)
document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
var menu = document.getElementById(menuId);
var actuator = document.getElementById(actuatorId);

if (menu == null || actuator == null) return;

//if (window.opera) return; // I'm too tired

actuator.parentNode.style.backgroundImage = "url(/images/plus.gif)";
actuator.onclick = function() {
var display = menu.style.display;
this.parentNode.style.backgroundImage =
(display == "block") ? "url(/images/plus.gif)" : "url(/images/minus.gif)";
menu.style.display = (display == "block") ? "none" : "block";

return false;
}
}
window.onload = function() {
initializeMenu("productsMenu", "productsActuator");
initializeMenu("newPhonesMenu", "newPhonesActuator");
initializeMenu("compareMenu", "compareActuator");
}
</script>
<style>
body {
font-family: verdana, helvetica, arial, sans-serif;
}

#mainMenu {
background-color: #EEE;
border: 1px solid #CCC;
color: #000;
width: 203px;
}

#menuList {
margin: 0px;
padding: 10px 0px 10px 15px;
}

li.menubar {
background: url(/images/plus.gif) no-repeat 0em 0.3em;
font-size: 12px;
line-height: 1.5em;
list-style: none outside;
}

.menu, .submenu {
display: none;
margin-left: 15px;
padding: 0px;
}

.menu li, .submenu li {
background: url(/images/square.gif) no-repeat 0em 0.3em;
list-style: none outside;
}

a.actuator {
background-color: transparent;
color: #000;
font-size: 12px;
padding-left: 15px;
text-decoration: none;
}

a.actuator:hover {
text-decoration: underline;
}

.menu li a, .submenu li a {
background-color: transparent;
color: #000;
font-size: 12px;
padding-left: 15px;
text-decoration: none;
}

.menu li a:hover, submenu li a:hover {
/*border-bottom: 1px dashed #000;*/
text-decoration: underline;
}

span.key {
text-decoration: underline;
}
</style>
</head>
<body>
<div id="mainMenu">
<ul id="menuList">
<li class="menubar">
<a href="#" id="productsActuator" class="actuator">图秀地带收藏夹</a>
<ul id="productsMenu" class="menu">
<li>
<a href="#" id="newPhonesActuator" class="actuator">我的好友</a>
<ul id="newPhonesMenu" class="submenu">
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
</ul>
</li>
<li>
<a href="#" id="compareActuator" class="actuator">陌生人</a>
<ul id="compareMenu" class="submenu">
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<script>
if (!document.getElementById)
document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
var menu = document.getElementById(menuId);
var actuator = document.getElementById(actuatorId);

if (menu == null || actuator == null) return;

//if (window.opera) return; // I'm too tired

actuator.parentNode.style.backgroundImage = "url(/images/plus.gif)";
actuator.onclick = function() {
var display = menu.style.display;
this.parentNode.style.backgroundImage =
(display == "block") ? "url(/images/plus.gif)" : "url(/images/minus.gif)";
menu.style.display = (display == "block") ? "none" : "block";

return false;
}
}
window.onload = function() {
initializeMenu("productsMenu", "productsActuator");
initializeMenu("newPhonesMenu", "newPhonesActuator");
initializeMenu("compareMenu", "compareActuator");
}
</script>
<style>
body {
font-family: verdana, helvetica, arial, sans-serif;
}

#mainMenu {
background-color: #EEE;
border: 1px solid #CCC;
color: #000;
width: 203px;
}

#menuList {
margin: 0px;
padding: 10px 0px 10px 15px;
}

li.menubar {
background: url(/images/plus.gif) no-repeat 0em 0.3em;
font-size: 12px;
line-height: 1.5em;
list-style: none outside;
}

.menu, .submenu {
display: none;
margin-left: 15px;
padding: 0px;
}

.menu li, .submenu li {
background: url(/images/square.gif) no-repeat 0em 0.3em;
list-style: none outside;
}

a.actuator {
background-color: transparent;
color: #000;
font-size: 12px;
padding-left: 15px;
text-decoration: none;
}

a.actuator:hover {
text-decoration: underline;
}

.menu li a, .submenu li a {
background-color: transparent;
color: #000;
font-size: 12px;
padding-left: 15px;
text-decoration: none;
}

.menu li a:hover, submenu li a:hover {
/*border-bottom: 1px dashed #000;*/
text-decoration: underline;
}

span.key {
text-decoration: underline;
}
</style>
</head>
<body>
<div id="mainMenu">
<ul id="menuList">
<li class="menubar">
<a href="#" id="productsActuator" class="actuator">图秀地带收藏夹</a>
<ul id="productsMenu" class="menu">
<li>
<a href="#" id="newPhonesActuator" class="actuator">我的好友</a>
<ul id="newPhonesMenu" class="submenu">
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
</ul>
</li>
<li>
<a href="#" id="compareActuator" class="actuator">陌生人</a>
<ul id="compareMenu" class="submenu">
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">张三[10000001]</a></li>
<li><a href="http://mc.mapabc.com/mapcard/card.jsp?pp=1000000001">李四[10000002]</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</body>
</BODY>
</HTML>
希望大虾帮我找出那里出错啦!!谢谢!!

搜索更多相关主题的帖子: 菜单 
2007-01-03 23:21
思轩
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-12-27
收藏
得分:0 

帮帮忙阿!!为什么到现在还没有人回复我啊!!小弟在这里跪谢各位拉!!!


2007-01-04 09:09
思轩
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-12-27
收藏
得分:0 
我问了我的老师,他是说里面定义的一个触发器,但是添加多一个的话没有办法进行判别的你的动作!就是说点击第二个的时候,服务器无法判断你的动作!故没有效果!!他是提示我把代码封装成两个函数,然后在具体地方直接调用函数就可以拉!!但是我还是听得一头雾水的!!那位大虾能具体一点的告诉我!!小弟在这万分感激!!

2007-01-04 10:09
快速回复:一个关于三家菜单的问题!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.067768 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved