| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 712 人关注过本帖
标题:高手来研究一下这个二级联动菜单修改成三级怎么搞.
只看楼主 加入收藏
jackmhl
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-6-18
收藏
 问题点数:0 回复次数:1 
高手来研究一下这个二级联动菜单修改成三级怎么搞.
我想把下面一个二级的修改成三级的菜单,那位高位帮我看看下面的如何写成三级的.

//js文件内容

var jobarea_s = new Array();
var jobarea_v = new Array();
var subarea_s = new Array();
var subarea_v = new Array();
//自己新增加的二个参数 作为三级城市分类
var cubarea_s = new Array();
var cubarea_v = new Array();
jobarea_s[0] = '北京';
jobarea_v[0] = '0100';
subarea_s[0] = new Array();
subarea_v[0] = new Array();
subarea_s[0][0] = '北京';
subarea_v[0][0] = '0100';

jobarea_s[1] = '上海';
jobarea_v[1] = '0200';
subarea_s[1] = new Array();
subarea_v[1] = new Array();
subarea_s[1][0] = '上海';
subarea_v[1][0] = '0200';
subarea_s[1][1] = '南浦';
subarea_v[1][1] = '0201';


jobarea_s[2] = '天津';
jobarea_v[2] = '0300';
subarea_s[2] = new Array();
subarea_v[2] = new Array();
subarea_s[2][0] = '天津';
subarea_v[2][0] = '0300';

jobarea_s[3] = '重庆';
jobarea_v[3] = '0400';
subarea_s[3] = new Array();
subarea_v[3] = new Array();
subarea_s[3][0] = '重庆';
subarea_v[3][0] = '0400';


function displayLayer(obj,layerID){
    hiddenLayer('popupArea','popupFuntype','popupSubfuntype','popupIndustry','popupIssuedate');
    
    var dv = document.getElementById(layerID);
    
    GetCenterXY_ForLayer(dv);
    DivSetVisible(dv);

    //dv.style.visibility = "visible";
}


function showSubjobarea(show,value,tag){
    var htmlDiv = '';
    var htmlDiv1 = '';
    
    
    if(subarea_s[tag].length == 1){
        sltJobarea(show,value);
    }else{
    
        var j = (6 - jobarea_s.length%6) == 6 ? 0 : (6 - jobarea_s.length%6);
        
        htmlDiv = htmlDiv + '<table width="645" border="0" cellspacing="0" cellpadding="0" bgcolor="#999999">';
        htmlDiv = htmlDiv + '<tr><td align="left" valign="middle" width="599" height="27" background="images/search/orangebg.gif">&nbsp;&nbsp;<img src="images/search/orangearrow.gif">&nbsp;<span style="color:#FFFFFF">请选择省份</span></td><td align="left" valign="middle" width="50" height="20" background="images/search/orangebg.gif"><span><a onclick="javascript:hiddenLayer(popupArea)" style="color:#FFFFFF;cursor:hand;">[关闭]</a></span></td></tr>';
        htmlDiv = htmlDiv + '<tr><td colspan="2" width="645" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
        
        htmlDiv = htmlDiv + '<tr>';
        for(var k=0;k<jobarea_s.length;k++){
            
            htmlDiv = htmlDiv + '<td width="100" height="20" align="center"><a style="cursor:hand" onclick="showSubjobarea(\''+jobarea_s[k]+'\',\''+jobarea_v[k]+'\',\''+k+'\')">'+jobarea_s[k]+'</a></td>';
            htmlDiv = htmlDiv + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
            if(k%6 == 5){
                htmlDiv = htmlDiv + '</tr><tr>';
            }
        }
        if(j > 0){
            for(var l=1;l<=j;l++){
                htmlDiv = htmlDiv + '<td width="100" height="20">&nbsp;</td>';
                htmlDiv = htmlDiv + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
            }
            htmlDiv = htmlDiv + '</tr>';
        }
        htmlDiv = htmlDiv + '</table>';
        
        var j = (6 - subarea_s[tag].length%6) == 6 ? 0 : (6 - subarea_s[tag].length%6);
    
        htmlDiv1 = htmlDiv1 + '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
        htmlDiv1 = htmlDiv1 + '<tr><td colspan="6" align="left">&nbsp;&nbsp;请选择城市</td></tr>';
        htmlDiv1 = htmlDiv1 + '<tr>';
        
        for(var k=0;k<subarea_s[tag].length;k++){
            
            htmlDiv1 = htmlDiv1 + '<td width="100" height="20" align="center"><a style="cursor:hand" onclick="sltJobarea(\''+subarea_s[tag][k]+'\',\''+subarea_v[tag][k]+'\')">'+subarea_s[tag][k]+'</a></td>';
            htmlDiv1 = htmlDiv1 + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
            if(k%6 == 5){
                htmlDiv1 = htmlDiv1 + '</tr><tr>';
            }
        }
        if(j > 0){
            for(var l=1;l<=j;l++){
                htmlDiv1 = htmlDiv1 + '<td width="100" height="20">&nbsp;</td>';
                htmlDiv1 = htmlDiv1 + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
            }
            htmlDiv1 = htmlDiv1 + '</tr>';
        }
        htmlDiv1 = htmlDiv1 + '</table></td></tr><tr><td colspan="2" height="4" bgcolor="#FF831F"></td></tr></table>';
    
        var dv = document.getElementById('popupArea');
        
        dv.innerHTML = htmlDiv + htmlDiv1;
        
        DivSetVisible(dv);
    }
    
}

function sltJobarea(show,value){
    //document.all("jobarea").value = value;
    document.quicksearch.jobarea.value = value;
    document.all("btnSltArea").value = show;
    document.all("btnSltArea1").value = show;
    hiddenLayer("popupArea");
}



function initJobArea(){
    var htmlDiv = '';
    var htmlDiv1 = '';
    var tag = 0;
        
    var j = (6 - jobarea_s.length%6) == 6 ? 0 : (6 - jobarea_s.length%6);
        
    htmlDiv = htmlDiv + '<table width="645" border="0" cellspacing="0" cellpadding="0" bgcolor="#999999">';
    htmlDiv = htmlDiv + '<tr><td align="left" valign="middle" width="599" height="27" background="images/search/orangebg.gif">&nbsp;&nbsp;<img src="images/search/orangearrow.gif" valign="middle">&nbsp;<span style="color:#FFFFFF" valign="middle">请选择省份</span></td><td align="left" valign="middle" width="50" height="20" background="images/search/orangebg.gif"><span><a onclick="javascript:hiddenLayer(popupArea)" style="color:#FFFFFF;cursor:hand;">[关闭]</a></span></td></tr>';
    htmlDiv = htmlDiv + '<tr><td colspan="2" width="645" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
    
    htmlDiv = htmlDiv + '<tr>';
    for(var k=0;k<jobarea_s.length;k++){
        
        htmlDiv = htmlDiv + '<td width="100" height="20" align="center"><a style="cursor:hand" onclick="showSubjobarea(\''+jobarea_s[k]+'\',\''+jobarea_v[k]+'\',\''+k+'\')">'+jobarea_s[k]+'</a></td>';
        htmlDiv = htmlDiv + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
        if(k%6 == 5){
            htmlDiv = htmlDiv + '</tr><tr>';
        }
    }

    if(j > 0){
        for(var l=1;l<=j;l++){
            htmlDiv = htmlDiv + '<td width="100" height="20">&nbsp;</td>';
            htmlDiv = htmlDiv + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
        }
        htmlDiv = htmlDiv + '</tr>';
    }
    htmlDiv = htmlDiv + '</table>';

    if(document.quicksearch.jobarea.value != ""){
        //取得tag
        for(var k=0;k<jobarea_v.length;k++){
            if(jobarea_v[k] == document.quicksearch.jobarea.value.substring(0,2)+'00'){
                tag = k;
                break;
            }
        }
        if(subarea_s[tag].length >1){
            var j = (6 - subarea_s[tag].length%6) == 6 ? 0 : (6 - subarea_s[tag].length%6);
            
            htmlDiv1 = htmlDiv1 + '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';
            htmlDiv1 = htmlDiv1 + '<tr><td colspan="6" align="left">&nbsp;&nbsp;请选择城市</td></tr>';
            htmlDiv1 = htmlDiv1 + '<tr>';
            
            for(var k=0;k<subarea_s[tag].length;k++){
                
                htmlDiv1 = htmlDiv1 + '<td width="100" height="20" align="center"><a style="cursor:hand" onclick="sltJobarea(\''+subarea_s[tag][k]+'\',\''+subarea_v[tag][k]+'\')">'+subarea_s[tag][k]+'</a></td>';
                htmlDiv1 = htmlDiv1 + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
                if(k%6 == 5){
                    htmlDiv1 = htmlDiv1 + '</tr><tr>';
                }
            }
            if(j > 0){
                for(var l=1;l<=j;l++){
                    htmlDiv1 = htmlDiv1 + '<td width="100" height="20">&nbsp;</td>';
                    htmlDiv1 = htmlDiv1 + '<td width="1" height="20" align="center" valign="middle"><img src="images/search/line_bg.gif"></td>';
                }
                htmlDiv1 = htmlDiv1 + '</tr>';
            }
            htmlDiv1 = htmlDiv1 + '</table>';
        }
    }
    htmlDiv = htmlDiv+htmlDiv1+'</td></tr><tr><td colspan="2" height="4" bgcolor="#FF831F"></td></tr></table>';
    
    var dv = document.getElementById('popupArea');
    dv.innerHTML = htmlDiv;
}



<form action="XXXXXX" method="post" target="_blank" name="quicksearch" >
<INPUT class=buttonstyle title=请选择地点 style="CURSOR: hand" onClick="initJobArea();displayLayer(this,'popupArea')" type=button value=选择/修改 name=btnSltArea>

[[it] 本帖最后由 jackmhl 于 2008-6-18 11:11 编辑 [/it]]

未命名.jpg (24.54 KB)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 菜单 研究 new 
2008-06-18 11:08
jackmhl
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-6-18
收藏
得分:0 
怎么就没有人来给我回呀..
2008-06-18 14:57
快速回复:高手来研究一下这个二级联动菜单修改成三级怎么搞.
数据加载中...
 
   



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

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