<div style="height:100;width:160;overflow:auto">
<script language="Javascript">
<!--
var n=15; //菜单数目
function onChange(i){
//try{childSort=document.all("child" + i);
if(childSort.style.display=="none"){
childSort.style.display="";
}
else{
childSort.style.display="none";
}
closeOther(i);//}catch(e){};
}
function closeOther(j){
var i;
for(i=0;i<=n;i++){
  if(i!=j){
childSort=document.all("child" + i);
childSort.style.display="none";
  }
}
}
//内容多时,滚动菜单区
function MenuUp(j){
alert("让下面的内容向上移动");
//让 name="content"+j 的div中的内容向上移动
}
function MenuDown(j){
alert("让下面的内容向下移动");
//让 name="content"+j 的div中的内容向下移动
}var MenuItem=new Array();
for(i=0;i<=n;i++) MenuItem[i]=new Array();MenuItem[0][0]="系统配置";
MenuItem[0][1]="修改密码,modify_pass.asp";
MenuItem[0][2]="增加管理员,add_adminUser.asp";
MenuItem[0][3]="修改管理员,modify_adminUser.asp";MenuItem[1][0]="公司信息";
MenuItem[1][1]="公司简介,CompanyInfo_1.asp";
MenuItem[1][2]="公司简介,CompanyInfo_1.asp";
MenuItem[1][3]="公司简介,CompanyInfo_1.asp";
MenuItem[1][4]="公司简介,CompanyInfo_1.asp";MenuItem[2][0]="留言管理";
MenuItem[2][1]="管理留言,dd.asp";
MenuItem[2][2]="版面更换,dd.asp";MenuItem[3][0]="新闻中心";
MenuItem[3][1]="栏目管理,dd.asp";
MenuItem[3][2]="添加文章,dd.asp";
MenuItem[3][3]="文章管理,dd.asp";
MenuItem[3][4]="上传文件管理,dd.asp";MenuItem[4][0]="产品展示";
MenuItem[4][1]="分类管理,dd.asp";
MenuItem[4][2]="添加产品,dd.asp";
MenuItem[4][3]="产品维护,dd.asp";
MenuItem[4][4]="上传文件管理,dd.asp";MenuItem[5][0]="会员管理";
MenuItem[5][1]="注册新会员,dd.asp";
MenuItem[5][2]="维护资料,dd.asp";MenuItem[6][0]="上传下载";
MenuItem[6][1]="目录管理,dd.asp";
MenuItem[6][2]="上传文件,dd.asp";
MenuItem[6][3]="文件管理,dd.asp";
MenuItem[6][4]="系统管理,dd.asp";MenuItem[7][0]="人才招聘";
MenuItem[7][1]="部门管理,dd.asp";
MenuItem[7][2]="增加部门,dd.asp";
MenuItem[7][3]="职位管理,dd.asp";
MenuItem[7][4]="增加职位,dd.asp";
MenuItem[7][5]="应聘信息,dd.asp";MenuItem[8][0]="企业论坛";
MenuItem[8][1]="进入管理,dd.asp";MenuItem[9][0]="订单管理";
MenuItem[9][1]="定单处理,dd.asp";MenuItem[10][0]="网站公告";
MenuItem[10][1]="公告管理,dd.asp";MenuItem[11][0]="网上调查";
MenuItem[11][1]="添加投票,dd.asp";
MenuItem[11][2]="投票管理,dd.asp";MenuItem[12][0]="网上商城";
MenuItem[12][1]="网上商城,dd.asp";
MenuItem[12][2]="网上商城,dd.asp";MenuItem[13][0]="Menu13";
MenuItem[13][1]="Menu13,../dd.asp";
MenuItem[13][2]="Menu13,../ll.asp";
MenuItem[13][3]="Menu13,../ur.asp";
MenuItem[13][4]="Menu13,../y.asp";
MenuItem[13][5]="Menu13,../ek.asp";
MenuItem[13][6]="Menu13,../th.asp";
MenuItem[14][0]="Menu14";
MenuItem[14][1]="one,../one.asp";
MenuItem[14][2]="two,../two.asp";MenuItem[15][0]="Menu15";
MenuItem[15][1]="one,../one.asp";
MenuItem[15][2]="two,../two.asp";//MenuItem[0][0]="";
function CreateMenu(){
  var temp,i,j,tempStr,strHeader,strFooter;
  for(i=0;i<MenuItem.length;i++){
    strHeader='';strFooter='';
    if(MenuItem[i].length>5){
strHeader+='      <tr><td colspan=2 align="right" style="line-height:10px;"><a onmouseover=MenuUp('+i+') style="cursor:hand;">A</a>&nbsp;<a onmouseover="MenuDown('+i+')" style="cursor:hand;">V</a>&nbsp;&nbsp;</td></tr>'
strHeader+='      <tr><td><div id=content'+i+' style="z-index:1;"><table cellpadding="0" cellspacing="0" border="0" width="110">'
strFooter+='       </table></div></td>'
    }
document.write('<table class="table" width="116" border=0 align="center" cellpadding="0" cellspacing="0">')
document.write('  <tr> ')
document.write('    <td height="24" align="center" background="images/m_niu_0.gif"px> <a href="Javascript:onChange('+i+')" class="a1" style="cursor:hand;" onclick="">'+MenuItem[i][0]+'</a></td>')
document.write('  </tr>')
document.write('  <tr> ')
document.write('    <td align="center" background="images/m_lbg.gif" bgcolor="F0FBFE"> <table width="116" border="0" cellspacing="0" cellpadding="0" id=child'+i+' style="display:none">')
document.write(strHeader)
    for(j=1;j<MenuItem[i].length;j++){
tempStr=MenuItem[i][j];
tempStr=tempStr.split(/,/)
document.write('        <tr> ')
document.write('          <td width="31" align="right"><img src="images/m_point1.gif" width="7" height="7"></td>')
document.write('          <td width="79"><a href="'+tempStr[1]+'" class="a2" target="FrameContent">'+tempStr[0]+'</a></td>')
document.write('        </tr>')
    }
document.write(strFooter)
document.write('      </table></td>')
document.write('  </tr>')
document.write('</table>')
  }
}
CreateMenu();
//-->
</script>
</div>

解决方案 »

  1.   

    首先感谢哈,你可能没有懂我的意思!
    这是一个在左边的frame内容,整个页面是左右结构,但我的菜单有18个之多,下面的二级菜单个数不定,当展开二级菜单时,在最下面的就显示不全,我就想到用二级菜单用鼠标控制滚动的方式显示,怎么才可以实现?
      

  2.   

    很无奈啊,看来我得把分全给[whnnet(赚钱攒嫁妆)],但他给的答案不是我说的要求。现在把我的答案贴出来:
    <script language="Javascript">
    <!--
    /*************************************************
     * OICQ:49047881   *
     *          Http://www.TopScripts.net   *
     *    Scripts writen by Netfound. 2004.09.27~30   *
     **************************************************/
    //检查浏览器
    function NavigatorInfo(){
    this.appN=navigator.appName
    this.ver=navigator.appVersion
    this.agent=navigator.userAgent
    this.dom=document.getElementById?1:0
    this.opera5=this.agent.indexOf("Opera 5")>-1
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
    this.ie=this.ie4||this.ie5||this.ie6
    this.mac=this.agent.indexOf("Mac")>-1
    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0
    this.ns4=(document.layers && !this.dom)?1:0
    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5) this.IsIe=(this.appN=="Microsoft Internet Explorer")?true:false
    this.IsNS=(this.appN=="Netscape")?true:false
    this.ieVer=this.ver.split(";")[1].substr(6).replace(/(^\s*)|(\s*$)/g, "")
    return this
    }
    //取得浏览器对象相关属性
    var Nav=new NavigatorInfo();
    //根据浏览器得到对象obj:对象id;nest:对象的父亲id
    function makeObj(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.';
    this.css=Nav.dom? document.getElementById(obj).style:Nav.ie4?document.all[obj].style:Nav.ns4?eval(nest+"document.layers." +obj):0;
    this.elm=Nav.dom?document.getElementById(obj):Nav.ie4?document.all[obj]:Nav.ns4?eval(nest+'document.'+obj):0;
    this.ref=Nav.dom || Nav.ie4? document:Nav.ns4?eval(nest+"document.layers." +obj+".document"):0;
    this.xpos= Nav.ns4?this.css.left:Nav.opera5?this.css.pixelLeft:this.elm.offsetLeft;
    this.ypos= Nav.ns4?this.css.top:Nav.opera5?this.css.pixelTop:this.elm.offsetTop;
    this.height= Nav.ns4?this.ref.height:Nav.opera5?this.css.pixelHeight:this.elm.offsetHeight;
    this.showObj=obj_show
    this.hideObj=obj_hide
    return this
    }
    //显示与隐藏对象
    function obj_show(){
    this.css.display="";
    }
    function obj_hide(){
    this.css.display="none";
    }
    //目录树的展开与关闭
    function onChange(i){
    //try{
    clearInterval(timer);speed=0
    var childSort=new makeObj("child" + i);
    if(childSort.css.display=="none"){
    childSort.css.display=""
    openState=true
    }else{
    childSort.css.display="none"
    openState=false
    }
    closeOther(i);
    MenuMove(i)
    //}catch(e){};
    }
    function closeOther(j){
    var i;
    for(i=0;i<MenuItem.length;i++){
      if(i!=j){
    childSort=new makeObj("child" + i)
    childSort.css.display="none"
      }
    }
    }
    //动态滚动菜单
    var speed=0,timer;
    function MenuScroll(j){
    self.scroll(0,++speed);
    if(speed>19*j){clearInterval(timer);speed=0 }
    }
    //内容多时,使当前操作的菜单区移动到可视区
    function MenuMove(j){
    if(openState && MenuItem[j].length>MenuItem.length-j){
    timer=setInterval("MenuScroll("+j+")",15);
    // self.scroll(0,19*j)
    scrollState=true
    }else if(!openState){
    scrollState=false
    self.scroll(0,0)
    }else{
    true
    }
    }
    //创建菜单
    function CreateMenu(){
      var temp,i,j,tempStr,strHeader,strFooter;
      for(i=0;i<MenuItem.length;i++){
        strHeader='';strFooter='';
        if(MenuItem[i].length>MenuItem.length-i){
    strHeader+='      <tr><td colspan=2 align="right" style="height:14px;" valign="absbottom"><a id="switch'+i+'" onClick=MenuMove('+i+') style="cursor:hand;">A</a>&nbsp;&nbsp;&nbsp;</td></tr>'
    strHeader+='      <tr><td><table cellpadding="0" cellspacing="0" border="0" width="110">'
    strFooter+='       </table></td>'
        }
    document.write('<table class="table" width="116" border=0 align="center" cellpadding="0" cellspacing="0">')
    document.write('  <tr> ')
    document.write('    <td height="24" align="center" background="images/m_niu_0.gif"> <a href="Javascript:onChange('+i+')" class="a1" style="cursor:hand;" onclick="">'+MenuItem[i][0]+'</a></td>')
    document.write('  </tr>')
    document.write('  <tr> ')
    document.write('    <td align="center" background="images/m_lbg.gif" bgcolor="F0FBFE"><table width="116" border="0" cellspacing="0" cellpadding="0" id=child'+i+' style="display:none">')
    // document.write(strHeader)
        for(j=1;j<MenuItem[i].length;j++){
    tempStr=MenuItem[i][j];
    tempStr=tempStr.split(/\|/)
    document.write('        <tr> ')
    document.write('          <td width="31" align="right"><img src="images/m_point1.gif" width="7" height="7"></td>')
    document.write('          <td width="79"><a href="'+tempStr[1]+'" class="a2" target="'+tempStr[2]+'">'+tempStr[0]+'</a></td>')
    document.write('        </tr>')
        }
    // document.write(strFooter)
    document.write('      </table></td>')
    document.write('  </tr>')
    document.write('</table>')
      }
    }var openState=false; //菜单闭合状态
    var scrollState=false; //菜单滚动状态//下面放生成的jsvar n=16;//菜单数目,用于创建生成菜单的二维数组
    var MenuItem=new Array();
    for(i=0;i<n;i++) MenuItem[i]=new Array();MenuItem[0][0]="系统配置";
    MenuItem[0][1]="修改密码,modify_pass.asp";
    MenuItem[0][2]="增加管理员,add_adminUser.asp";
    MenuItem[0][3]="修改管理员,modify_adminUser.asp";MenuItem[1][0]="公司信息";
    MenuItem[1][1]="公司简介,CompanyInfo_1.asp";
    MenuItem[1][2]="公司简介,CompanyInfo_1.asp";
    MenuItem[1][3]="公司简介,CompanyInfo_1.asp";
    MenuItem[1][4]="公司简介,CompanyInfo_1.asp";MenuItem[2][0]="留言管理";
    MenuItem[2][1]="管理留言,dd.asp";
    MenuItem[2][2]="版面更换,dd.asp";MenuItem[3][0]="新闻中心";
    MenuItem[3][1]="栏目管理,dd.asp";
    MenuItem[3][2]="添加文章,dd.asp";
    MenuItem[3][3]="文章管理,dd.asp";
    MenuItem[3][4]="上传文件管理,dd.asp";MenuItem[4][0]="产品展示";
    MenuItem[4][1]="分类管理,dd.asp";
    MenuItem[4][2]="添加产品,dd.asp";
    MenuItem[4][3]="产品维护,dd.asp";
    MenuItem[4][4]="上传文件管理,dd.asp";MenuItem[5][0]="会员管理";
    MenuItem[5][1]="注册新会员,dd.asp";
    MenuItem[5][2]="维护资料,dd.asp";MenuItem[6][0]="上传下载";
    MenuItem[6][1]="目录管理,dd.asp";
    MenuItem[6][2]="上传文件,dd.asp";
    MenuItem[6][3]="文件管理,dd.asp";
    MenuItem[6][4]="系统管理,dd.asp";MenuItem[7][0]="人才招聘";
    MenuItem[7][1]="部门管理,dd.asp";
    MenuItem[7][2]="增加部门,dd.asp";
    MenuItem[7][3]="职位管理,dd.asp";
    MenuItem[7][4]="增加职位,dd.asp";
    MenuItem[7][5]="应聘信息,dd.asp";MenuItem[8][0]="企业论坛";
    MenuItem[8][1]="进入管理,dd.asp";MenuItem[9][0]="订单管理";
    MenuItem[9][1]="定单处理,dd.asp";MenuItem[10][0]="网站公告";
    MenuItem[10][1]="公告管理,dd.asp";MenuItem[11][0]="网上调查";
    MenuItem[11][1]="添加投票,dd.asp";
    MenuItem[11][2]="投票管理,dd.asp";MenuItem[12][0]="网上商城";
    MenuItem[12][1]="网上商城,dd.asp";
    MenuItem[12][2]="网上商城,dd.asp";MenuItem[13][0]="Menu13";
    MenuItem[13][1]="Menu13,../dd.asp";
    MenuItem[13][2]="Menu13,../ll.asp";
    MenuItem[13][3]="Menu13,../ur.asp";
    MenuItem[13][4]="Menu13,../y.asp";
    MenuItem[13][5]="Menu13,../ek.asp";
    MenuItem[13][6]="Menu13,../th.asp";
    MenuItem[14][0]="Menu14";
    MenuItem[14][1]="one,../one.asp";
    MenuItem[14][2]="two,../two.asp";MenuItem[15][0]="Menu15";
    MenuItem[15][1]="one,../one.asp";
    MenuItem[15][2]="two,../two.asp";
    //MenuItem[0][0]="";
    CreateMenu();
    //-->
    </script>