上面是调用的你改过的js,底下是调用和菜单<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页教学网无限级树型菜单演示</title>
<script src="xx.js" type="text/javascript">
//more javascript from http://www.webjx.com</script><style type="text/css"><!--#containerul, #containerul ul{
text-align:left;
margin:0; /* Removes browser default margins applied to the lists. */
padding:0; /* Removes browser default padding applied to the lists. */
}#containerul li{
margin:0 0 0 30px; /* A left margin to indent the list items and give the menu a sense of structure. */
padding:0; /* Removes browser default padding applied to the list items. */
list-style-type:none; /* Removes the bullet point that usually goes next to each item in a list. */
}#containerul .symbols{ /* Various styles to position the symbols next to the items in the menu. */
float:left;
width:12px;
height:1em;
background-position:0 50%;
background-repeat:no-repeat;
}--></style>
</head><body>
<ul id="containerul">
<li>逸然飞扬
<ul>
<li><a href="info.asp?ID=1" target="iframe">企业文化</a></li>
<li><a href="info.asp?ID=2" target="iframe">企业资质</a></li>
<li><a href="info.asp?ID=3" target="iframe">联系方式</a></li>
</ul>
</li>
<li>产品目录
<ul>
<li>摩托罗拉<ul><li><a href='ProList.asp?ID=94' target='iframe'>TEST</a></li><li><a href='ProList.asp?ID=95' target='iframe'>11111sdfs</a></li><li><a href='ProList.asp?ID=98' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='ProList.asp?ID=97' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='ProList.asp?ID=100' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='ProList.asp?ID=101' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
<li>配件精品
<ul>
<li><a href="ProClsPJ.asp?cls=MOTO%C5%E4%BC%FE" target="iframe">MOTO配件</a></li>
<li><a href="ProClsPJ.asp?cls=VERTEX%C5%E4%BC%FE" target="iframe">VERTEX配件</a></li>
<li><a href="ProClsPJ.asp?cls=ICOM%C5%E4%BC%FE" target="iframe">ICOM配件</a></li>
<li><a href="ProClsPJ.asp?cls=HYT%C5%E4%BC%FE" target="iframe">HYT配件</a></li>
<li><a href="ProClsPJ.asp?cls=%B3%B5%D4%D8%C5%E4%BC%FE" target="iframe">车载配件</a></li>
</ul>
</li>
<li>技术支持
<ul>
<li>写频软件
<ul>
<li>摩托罗拉<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=TEST' target='iframe'>TEST</a></li><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=11111sdfs' target='iframe'>11111sdfs</a></li><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=MTp706' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=小日本' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=123124' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=asdf' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
<li><a href="info.asp?ID=3" target="iframe">技术支持</a></li>
<li>维修手册
<ul>
<li>摩托罗拉<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=TEST' target='iframe'>TEST</a></li><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=11111sdfs' target='iframe'>11111sdfs</a></li><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=MTp706' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=小日本' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=123124' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=asdf' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
<li>信号覆盖方案
<ul>
<li>摩托罗拉<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=TEST' target='iframe'>TEST</a></li><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=11111sdfs' target='iframe'>11111sdfs</a></li><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=MTp706' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=小日本' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=123124' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=asdf' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
</ul>
</li>
<li>英才招聘
<ul><li><a href='JobView.asp?JobID=1' target='iframe'>销售人才</a><li><a href='JobView.asp?JobID=2' target='iframe'>技术人才</a><li><a href='JobView.asp?JobID=3' target='iframe'>售后人才</a><li><a href='JobView.asp?JobID=22' target='iframe'>客服人员</a></ul>
</li>
</ul><p>
<script type="text/javascript">
initiate(); // This must be placed immediately after the menu in order to format it properly.
</script>
</p>
<h3>树形菜单</h3>
<p>说明:一个很容易制作树形菜单,你可以无限级的添加下级菜单,菜单是通过列表方式写成的 </p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页教学网无限级树型菜单演示</title>
<script src="xx.js" type="text/javascript">
//more javascript from http://www.webjx.com</script><style type="text/css"><!--#containerul, #containerul ul{
text-align:left;
margin:0; /* Removes browser default margins applied to the lists. */
padding:0; /* Removes browser default padding applied to the lists. */
}#containerul li{
margin:0 0 0 30px; /* A left margin to indent the list items and give the menu a sense of structure. */
padding:0; /* Removes browser default padding applied to the list items. */
list-style-type:none; /* Removes the bullet point that usually goes next to each item in a list. */
}#containerul .symbols{ /* Various styles to position the symbols next to the items in the menu. */
float:left;
width:12px;
height:1em;
background-position:0 50%;
background-repeat:no-repeat;
}--></style>
</head><body>
<ul id="containerul">
<li>逸然飞扬
<ul>
<li><a href="info.asp?ID=1" target="iframe">企业文化</a></li>
<li><a href="info.asp?ID=2" target="iframe">企业资质</a></li>
<li><a href="info.asp?ID=3" target="iframe">联系方式</a></li>
</ul>
</li>
<li>产品目录
<ul>
<li>摩托罗拉<ul><li><a href='ProList.asp?ID=94' target='iframe'>TEST</a></li><li><a href='ProList.asp?ID=95' target='iframe'>11111sdfs</a></li><li><a href='ProList.asp?ID=98' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='ProList.asp?ID=97' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='ProList.asp?ID=100' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='ProList.asp?ID=101' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
<li>配件精品
<ul>
<li><a href="ProClsPJ.asp?cls=MOTO%C5%E4%BC%FE" target="iframe">MOTO配件</a></li>
<li><a href="ProClsPJ.asp?cls=VERTEX%C5%E4%BC%FE" target="iframe">VERTEX配件</a></li>
<li><a href="ProClsPJ.asp?cls=ICOM%C5%E4%BC%FE" target="iframe">ICOM配件</a></li>
<li><a href="ProClsPJ.asp?cls=HYT%C5%E4%BC%FE" target="iframe">HYT配件</a></li>
<li><a href="ProClsPJ.asp?cls=%B3%B5%D4%D8%C5%E4%BC%FE" target="iframe">车载配件</a></li>
</ul>
</li>
<li>技术支持
<ul>
<li>写频软件
<ul>
<li>摩托罗拉<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=TEST' target='iframe'>TEST</a></li><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=11111sdfs' target='iframe'>11111sdfs</a></li><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=MTp706' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=小日本' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=123124' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='XpSoftDown.asp?ID=4&HK_ClassTitle=asdf' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
<li><a href="info.asp?ID=3" target="iframe">技术支持</a></li>
<li>维修手册
<ul>
<li>摩托罗拉<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=TEST' target='iframe'>TEST</a></li><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=11111sdfs' target='iframe'>11111sdfs</a></li><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=MTp706' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=小日本' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=123124' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='XpSoftDown.asp?ID=5&HK_ClassTitle=asdf' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
<li>信号覆盖方案
<ul>
<li>摩托罗拉<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=TEST' target='iframe'>TEST</a></li><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=11111sdfs' target='iframe'>11111sdfs</a></li><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=MTp706' target='iframe'>MTp706</a></li></ul></li>
<li>日本建伍<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=小日本' target='iframe'>小日本</a></li></ul></li>
<li>威泰克斯</li>
<li>艾可慕<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=123124' target='iframe'>123124</a></li></ul></li>
<li>好易通<ul><li><a href='XpSoftDown.asp?ID=6&HK_ClassTitle=asdf' target='iframe'>asdf</a></li></ul></li>
<li>其他品牌</li>
</ul>
</li>
</ul>
</li>
<li>英才招聘
<ul><li><a href='JobView.asp?JobID=1' target='iframe'>销售人才</a><li><a href='JobView.asp?JobID=2' target='iframe'>技术人才</a><li><a href='JobView.asp?JobID=3' target='iframe'>售后人才</a><li><a href='JobView.asp?JobID=22' target='iframe'>客服人员</a></ul>
</li>
</ul><p>
<script type="text/javascript">
initiate(); // This must be placed immediately after the menu in order to format it properly.
</script>
</p>
<h3>树形菜单</h3>
<p>说明:一个很容易制作树形菜单,你可以无限级的添加下级菜单,菜单是通过列表方式写成的 </p>
</body>
</html>
刚学asp三个月,js看了点皮毛,我当然想自己去写,但是先阶段我的能力明显心有余而力不足,代码也只能先拿别人的,别人耐心的给我解答,我当然要把代码好好看一遍,再去运用,谁都不是生而知之的,是有一 个过程的,请也允许给我一个这样的过程,你提供我的思路,试问我可以懂吗?我能花多长时间用你的思路去解决我的问题?我不想说你,也没资格说你,只是觉得你在有些方面确实有愧于你四颗星的尊严和标准,你很多时候只是去评论别人的回答,当然我说这些是没有用的,我重申我的观点,个人冲突,不要伤害无辜,“工具”一词,我实在不知道chinmo老兄用在这的道理何在。人总是会进步的,谢谢你的教导,我会努力的更谢谢那么耐心帮助我的人,你们的耐心是我进步的支持和动力,谢谢!
至于打开时就展开指定的菜单参照我在你的另一个帖子里的回复即可。
var temp, temp2, cookieArray, cookieArray2, cookieCount;function initiate(){ cookieCount=0; if(document.cookie)
{
cookieArray=document.cookie.split(";"); cookieArray2=new Array(); for(i in cookieArray)
{
cookieArray2[cookieArray[i].split("=")[0].replace(/ /g,"")]=cookieArray[i].split("=")[1].replace(/ /g,"");
}
} cookieArray=(document.cookie.indexOf("state=")>=0)?cookieArray2["state"].split(","):new Array(); temp=document.getElementById("containerul"); for(var o=0;o<temp.getElementsByTagName("li").length;o++)
{
if(temp.getElementsByTagName("li")[o].getElementsByTagName("ul").length>0)
{
temp2 = document.createElement("span");
temp2.className = "symbols";
temp2.style.backgroundImage = (cookieArray.length>0)?((cookieArray[cookieCount]=="true")?"url(tree/minus.png)":"url(tree/plus.png)"):"url(tree/plus.png)";
//Added by jasson
if( !temp.getElementsByTagName("li")[o].firstChild.tagName)
{
var html = temp.getElementsByTagName("li")[o].innerHTML;
var title = html.substr(0, html.indexOf("<UL>"))
html = html.substr( html.indexOf("<UL>") )
temp.getElementsByTagName("li")[o].innerHTML = html;
var spanTitle = document.createElement("span");
spanTitle.innerText = title;
spanTitle.style.cursor = "hand";
temp.getElementsByTagName("li")[o].insertBefore(spanTitle ,temp.getElementsByTagName("li")[o].firstChild)
} temp.getElementsByTagName("li")[o].insertBefore(temp2,temp.getElementsByTagName("li")[o].firstChild)
temp.getElementsByTagName("li")[o].getElementsByTagName("ul")[0].style.display = (cookieArray.length>0)?((cookieArray[cookieCount]=="true")?"block":"none"):"none";
temp.getElementsByTagName("li")[o].children[0].onclick = temp.getElementsByTagName("li")[o].children[1].onclick =function()
{
showhide(this.parentNode);
writeCookie();
} cookieCount++; }
else
{
temp2 = document.createElement("span");
temp2.className = "symbols";
temp2.style.backgroundImage = "url(tree/page.png)"; temp.getElementsByTagName("li")[o].insertBefore(temp2,temp.getElementsByTagName("li")[o].firstChild); } }}function showhide(el)
{
el.getElementsByTagName("ul")[0].style.display=(el.getElementsByTagName("ul")[0].style.display=="block")?"none":"block";
el.getElementsByTagName("span")[0].style.backgroundImage=(el.getElementsByTagName("ul")[0].style.display=="block")?"url(tree/minus.png)":"url(tree/plus.png)";
// add by jasson
if( el.getElementsByTagName("ul")[0].style.display=="block")
{
if( el.parentElement )
{
var parUL = el.parentElement; for( var i=0;i<parUL.children.length;i++ )
{
var curEL = parUL.children[i];
if( curEL.tagName.toLowerCase()=="li" && curEL !=el )
{
if( curEL.getElementsByTagName("ul").length > 0 )
{
curEL .getElementsByTagName("ul")[0].style.display= "none";
curEL .getElementsByTagName("span")[0].style.backgroundImage= "url(tree/plus.png)";
}
}
}
}
}}function writeCookie(){ // Runs through the menu and puts the "states" of each nested list into an array, the array is then joined together and assigned to a cookie. cookieArray=new Array() for(var q=0;q<temp.getElementsByTagName("li").length;q++){ if(temp.getElementsByTagName("li")[q].childNodes.length>0){
if(temp.getElementsByTagName("li")[q].childNodes[0].nodeName=="SPAN" && temp.getElementsByTagName("li")[q].getElementsByTagName("ul").length>0){ cookieArray[cookieArray.length]=(temp.getElementsByTagName("li")[q].getElementsByTagName("ul")[0].style.display=="block"); }
} } document.cookie="state="+cookieArray.join(",")+";expires="+new Date(new Date().getTime() + 365*24*60*60*1000).toGMTString();}
我错了行吗?我是不是做网站每个地方都要往这来发帖子,要代码?
我是不是就是光给贴对了代码的分了?
你真让我无语,不依不饶的,我有说“我只要代码”吗?
我有说我不学习吗?
你这人怎么这么客气,我问个问题惹来你这么多气?
我不是说了吗?你是思路就算明白我也不知道如何下手啊?
难道你刚学习的时候asp用的上传类是自己写的?
难道你没有用过一段别人的代码?
真是没事找气生
我至少不像你这样,我刚学的时候还没几个会ASP的,想问都没得问而且我也从不轻易问人,一问肯定是90%的人做不出来的效果才会问,而且只喜欢别人提供思路,自己写,写错了再让人指点为什么错,该如何纠正才好!不像你直接来一句:我不懂JS,直接帮我写吧之类的话