我现在使用publish.asp、areacityselector.js遇到了问题AreaWill = Split(Replace_Text(Request.Form("slt_selectedplaces")),",")接收到的是"北京"、“上海”这样的值,我想接收的是数组值所在的下标比如北京是"00",上海是"01"
在pulish.asp的调用:
<SCRIPT language=JavaScript src="../js/areacityselector.js"></SCRIPT>SELECT  id=select5  name=slt_category  style="width:180px">
</SELECT><select  name=slt_subcategory size="1"  id=select6 style="width:180px"></select>
<table width="98%" border="0" cellspacing="0" class="text01">
<td height="25" align="center"><input type="button" name="Submit2" value="添加&gt;&gt;" onClick="AddItemToList('slt_category','slt_subcategory','slt_selectedjobs',3, 1, '-')">
<td height="25" align="center"><input type="button" name="Submit3" value="&lt;&lt;移除" onClick="DeleteListSelectedItem('slt_selectedjobs', 0)">
<SELECT  multiple size=3 name=slt_selectedjobs style="width:200px"></SELECT>AreaWill = Split(Replace_Text(Request.Form("slt_selectedplaces")),",")
                              
pulish.asp的js代码<SCRIPT language=JavaScript>
  var objJobCPSelector, objJobCCSelector, objAreaSelector, objCitySelector
  objAreaSelector = new PlaceAssociateList(document.reg.slt_workplacearea, null, document.reg.slt_workplacecity, ALOptions);
  objAreaSelector.init();
  objCitySelector = new PlaceAssociateList(document.reg.slt_workplacecity, document.reg.slt_workplacearea, null, CLOptions);
  objCitySelector.incPValue = true;
  objCitySelector.incPValueFormat = "%PText%-不限"
  objCitySelector.init();
  objJobCPSelector = new JobCategoryAssociateList(document.reg.slt_category, null, document.reg.slt_subcategory, PCLOptions);
  objJobCPSelector.init();
  objJobCCSelector = new JobCategoryAssociateList(document.reg.slt_subcategory, document.reg.slt_category, null, CCLOptions);
  objJobCCSelector.incPValue = true;
  objJobCCSelector.incPValueFormat = "%PText%-不限"
  objJobCCSelector.init();function AddItemToList(sObjListID1, sObjListID2, tObjListID, limit, combtype, joinchar)
{
    var sObjList1, sObjList2, tObjList, selectedItem;
    sObjList1 = document.getElementById(sObjListID1);
    sObjList2 = document.getElementById(sObjListID2);
    tObjList  = document.getElementById(tObjListID);
    if( sObjList1 != null && sObjList2 != null && tObjList != null )
    {
        if( sObjList1.selectedIndex >= 0 && sObjList2.selectedIndex >= 0)
        {
            if( tObjList.length < limit || limit == 0 )
            {
                selectedItem = sObjList2.options[sObjList2.selectedIndex];
                for( i=0; i<tObjList.length; i++ )
                {
                    if( tObjList.options[i].value == selectedItem.value )
                    {
                        alert("已经选择有该项!");
                        return;
                    }
                    else if( selectedItem.value.indexOf(tObjList.options[i].value)==0 )
                    {
                        alert("已经选择了该类不限!");
                        return;
                    }
                    else if( tObjList.options[i].value.indexOf(selectedItem.value)==0 )
                    {
                        alert("与已经选择的项有冲突!");
                        return;
                    }
                }
                switch( combtype )
                {
                case 1:// 组合两个源选框文本
                    if(sObjList1.options[sObjList1.selectedIndex].value == 
                        sObjList2.options[sObjList2.selectedIndex].value)
                      tObjList.options[tObjList.length] = new Option(
                        sObjList2.options[sObjList2.selectedIndex].text,
                        selectedItem.value);
                    else
                      tObjList.options[tObjList.length] = new Option(
                        sObjList1.options[sObjList1.selectedIndex].text + joinchar + selectedItem.text,
                        selectedItem.value);
                    tObjList.options[tObjList.length-1].selected = true;
                    break;
                case 2:// 使用源选框二的值
                    tObjList.options[tObjList.length] = new Option(
                    selectedItem.value.replace(joinchar, ""), selectedItem.value);
                    tObjList.options[tObjList.length-1].selected = true;
                    break;
                }
            }
            else
            {
                alert("最多只能添加" + limit + "项!");
            }
        }
    }
}areacityselector.js代码:var ALOptions = new Array()
// 城市选项列表
var CLOptions = new Array()
GeneratePlaceList()
// 生成地区和城市选项列表
function GeneratePlaceList()
{
    var ii = 0
    var jj = 0  
    ALOptions[ii++] = "北京-|北京市"   
    ALOptions[ii++] = "天津-|天津市"
    ALOptions[ii++] = "上海-|上海市"
    ALOptions[ii++] = "重庆-|重庆市"
    ALOptions[ii++] = "广东-|广东省"    
    ii = 0     
    jj = 0
    
    // ii = 0
    CLOptions[ii] = new Array()
    CLOptions[ii++][jj++] = "北京-|北京市" 
    jj = 0
    // ii = 1
    CLOptions[ii] = new Array()
    CLOptions[ii++][jj++] = "天津-|天津市"  
    jj = 0
    // ii = 2
    CLOptions[ii] = new Array()
    CLOptions[ii++][jj++] = "上海-|上海市"   
    jj = 0
    // ii = 3
    CLOptions[ii] = new Array()
    CLOptions[ii++][jj++] = "重庆-|重庆市"
    jj = 0
    // ii = 4
    CLOptions[ii] = new Array()
    CLOptions[ii][jj++] = "广东-广州|├-广州市"
    CLOptions[ii][jj++] = "广东-深圳|├-深圳市"
    CLOptions[ii][jj++] = "广东-珠海|├-珠海市"
    CLOptions[ii][jj++] = "广东-东莞|├-东莞市"
    CLOptions[ii][jj++] = "广东-佛山|├-佛山市"
    CLOptions[ii][jj++] = "广东-汕头|├-汕头市"
}function PlaceAssociateList(instance, parent, child, optionList)
{
    this.parent          = parent;              // 父选择框
    this.child           = child;               // 子选择框
    this.instance        = instance;            // 与对象关联的选择框实例
    this.optionList      = optionList;          // 选择框选项列表
    this.initValue       = null;                // 选择框初始值
    this.addedOptions    = null;                // 附加选项
    this.incPValue       = false;               // 包含父值
    this.incPValueFormat = "%PText%";           // 包含父值的选项的文本格式
    this.allowEmpty      = false;               // 允许空选项列表
    this.init            = InitPlaceSelector;   // 初始化方法
    this.SetSelectedValue = SetSelectedValue;   // 设置选中值方法
    this.instance.associateObject = this;       // 关联对象与选择框
}
确实有点长 我想接到的是CLOptions和ALOptions的下标而不是值应该怎么该呢? 比如 北京--北京市 "[00][00]"而不是其值文字的"北京" "广东-广州|├-广州市" 4000