| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 506 人关注过本帖
标题:这段分级菜单 为什么 不能加入 超链接
只看楼主 加入收藏
d778
Rank: 1
等 级:新手上路
帖 子:257
专家分:0
注 册:2006-1-10
收藏
 问题点数:0 回复次数:1 
这段分级菜单 为什么 不能加入 超链接


例如红色部分的代码? 怎样加入 链接呢
<style type="text/css">
.titleStyle{
background-color:#6699CC;color:#ffffff;
border-top:1px solid #FFFFFF;font-size:9pt;cursor:hand;
}
.contentStyle{
background-color:#efefef;color:blue;font-size:9pt;
}
</style>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=javascript>
<!--
var mMenu=new Array()
var headHeight = 22;//每个标题的高度
var bodyHeight = 260;//母体高度
var objcount = 6;//项目的个数,要改变了项目的个数别忘了该这个东西
var step = 6;//移动速度(请确认可以被'bodyHeight-headHeight'整除,当前的设定可选速度为1,2,3,6,23,138)
var moving = false;//是否有移动的项目
var layerTop=360; //菜单顶边距
var layerLeft=130; //菜单左边距
var layerWidth=140; //菜单总宽度
var titleHeight=20; //标题栏高度
var contentHeight=200; //内容区高度
var stepNo=1; //移动步数,数值越大移动越慢
var itemNo=0;

function regsterMenu(menu){
mMenu[mMenu.length]=menu;
return mMenu.length-1;
}
function mainMenu(img,capture,hrefurl){
this.items=new Array();
this.img=img;
this.capture=capture;
this.hrefurl=hrefurl;
this.id=regsterMenu(this);
}
//img 是作为图标的图像位置
//capture 是连接的文字
//href是超连接的地址
function subMenu(img,capture,hrefurl){
this.img=img;
this.capture=capture;
this.hrefurl=hrefurl;
}
function addSub(item){
this.items[this.items.length]=item;
}
mainMenu.prototype.addSub=addSub;

function generateHtml(mmenu){
var menuHTML="";
menuHTML+="<span id=itemsLayer style=\"position:absolute;overflow:hidden;border:1px solid #008800;left:'"+layerLeft+"';top:'"+layerTop+"';width:'"+layerWidth+"';\">"
for(var i=0;i<mmenu.length;i++){
menuHTML+="<div id=item"+i+" style=\"LEFT: 0px; WIDTH: "+layerWidth+"; POSITION: relative; TOP:-"+contentHeight*i+"px\" itemIndex=\""+i+"\"><TABLE cellSpacing=0 cellPadding=0 width=\"100%\"><TBODY><TR><TD class=titleStyle onclick=changeItem("+i+") align=middle height="+titleHeight+">"+mmenu[i].capture+"</TD></tr>"
if(mmenu[i].items.length!=0){
menuHTML+="<TR><TD class=contentStyle height=200><div style=\"overflow:auto;height:200;\">"
for(var q=0;q<mmenu[i].items.length;q++){
menuHTML+="<BR><CENTER>"+mmenu[i].items[q].capture+"</CENTER>"
}
menuHTML+="</div></TD></TR>"
}
menuHTML+="</TBODY></TABLE></DIV>"
}
menuHTML+="</span>"
return menuHTML;
}

var mm1=new mainMenu('#','金融机具系列','#');
mm1.addSub(new subMenu('#','点钞机','#'));
mm1.addSub(new subMenu('#','娱乐世界','#'));

mm2=new mainMenu('#','利率显示屏系列','#');
mm2.addSub(new subMenu('#','娱乐世界','#'));
mm3=new mainMenu('#','运钞系列','#');
mm3.addSub(new subMenu('#','娱乐世界','#'));
mm4=new mainMenu('#','卡袋系列','#');
mm4.addSub(new subMenu('#','娱乐世界','#'));
mm4.addSub(new subMenu('#','娱乐世界','#'));
mm5=new mainMenu('#','银行办公系列','#');
mm5.addSub(new subMenu('#','娱乐世界','#'));
mm5.addSub(new subMenu('#','娱乐世界','#'));
mm6=new mainMenu('#','宣传品系列','#');
mm6.addSub(new subMenu('#','娱乐世界','#'));
mm6.addSub(new subMenu('#','娱乐世界','#'));
mm7=new mainMenu('#','印章','#');
mm7.addSub(new subMenu('#','娱乐世界','#'));
mm7.addSub(new subMenu('#','娱乐世界','#'));
document.write (generateHtml(mMenu));
document.all.itemsLayer.style.height =mMenu.length*titleHeight+contentHeight;

//************************************************************
var toItemIndex=mMenu.length-1;
var onItemIndex=mMenu.length-1;
var runtimes=0; //"runtimes"用于记录层移动次数
//菜单标题被点击时调用这个函数:
function changeItem(clickItemIndex){
//myid.innerText=" "+itemsLayer.outerHTML+" "
//判断相应的层应上移还是下移:
toItemIndex=clickItemIndex;
if(toItemIndex-onItemIndex>0) moveUp();
else moveDown();
//一定的时间间隔后继续移动,直到移了设定的步数stepNo:
runtimes++;
if(runtimes>=stepNo){
onItemIndex=toItemIndex;
runtimes=0;}
else
setTimeout("changeItem(toItemIndex)",10);

}
//相应菜单上移:
function moveUp(){
//判断应一起上移的菜单,并让它(们)每次移动contentHeight/stepNo的距离:
for(i=onItemIndex+1;i<=toItemIndex;i++)
eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-contentHeight/stepNo;');
}
//相应菜单下移:
function moveDown(){
for(i=onItemIndex;i>toItemIndex;i--)
eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+contentHeight/stepNo;');
}
//changeItem(0); //把第一个菜单作为默认显示
//************************************************************

//-->
</SCRIPT>

搜索更多相关主题的帖子: 菜单 链接 分级 
2007-01-02 17:44
渚薰
Rank: 6Rank: 6
等 级:贵宾
威 望:22
帖 子:1132
专家分:0
注 册:2006-8-6
收藏
得分:0 
mm1.addSub(new subMenu('#','点钞机','1.asp'));
mm1.addSub(new subMenu('#','娱乐世界','2.asp'));

相关代码
function subMenu(img,capture,hrefurl){ //参数分别是图片,标题,链接
this.img=img;
this.capture=capture;
this.hrefurl=hrefurl;
}

function addSub(item){
this.items[this.items.length]=item;
}

[此贴子已经被作者于2007-1-3 10:53:30编辑过]


个人ajax技术专题站: " target="_blank">http://www. 我不会闲你烦,只会闲你不够烦!
2007-01-03 10:52
快速回复:这段分级菜单 为什么 不能加入 超链接
数据加载中...
 
   



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

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