下拉连动的例子,自己看看,修改一下。

发表于:2007-06-30来源:作者:点击数: 标签:
% dim province(35,2) province(1,1)=01 province(1,2)=河南 province(2,1)=02 province(2,2)=北京 province(3,1)=03 province(3,2)=河北 province(4,1)=04 province(4,2)=山西 province(5,1)=05 province(5,2)=内蒙古 province(6,1)=06 province(6,2)=辽宁 p
<%
dim province(35,2)
province(1,1)="01"
province(1,2)="河南"
province(2,1)="02"
province(2,2)="北京"
province(3,1)="03"
province(3,2)="河北"
province(4,1)="04"
province(4,2)="山西"
province(5,1)="05"
province(5,2)="内蒙古"
province(6,1)="06"
province(6,2)="辽宁"
province(7,1)="07"
province(7,2)="吉林"
province(8,1)="08"
province(8,2)="黑龙江"
province(9,1)="09"
province(9,2)="江苏"
province(10,1)="10"
province(10,2)="浙江"
province(11,1)="11"
province(11,2)="安徽"
province(12,1)="12"
province(12,2)="福建"
province(13,1)="13"
province(13,2)="上海"
province(14,1)="14"
province(14,2)="山东"
province(15,1)="15"
province(15,2)="天津"
province(16,1)="16"
province(16,2)="湖北"
province(17,1)="17"
province(17,2)="广东"
province(18,1)="18"
province(18,2)="广西"
province(19,1)="19"
province(19,2)="四川"
province(20,1)="20"
province(20,2)="贵州"
province(21,1)="21"
province(21,2)="云南"
province(22,1)="22"
province(22,2)="西藏"
province(23,1)="23"
province(23,2)="陕西"
province(24,1)="24"
province(24,2)="甘肃"
province(25,1)="25"
province(25,2)="青海"
province(26,1)="26"
province(26,2)="宁夏"
province(27,1)="27"
province(27,2)="新疆"
province(28,1)="28"
province(28,2)="香港"
province(29,1)="29"
province(29,2)="台湾"
province(30,1)="30"
province(30,2)="澳门"
province(31,1)="31"
province(31,2)="江西"
province(32,1)="32"
province(32,2)="重庆"
province(33,1)="33"
province(33,2)="海南"
province(34,1)="34"
province(34,2)="湖南"
province(35,1)="35"
province(35,2)="国外"
%>
<script language=javascript>
function GetObjID(ObjName)
{ for (var ObjID=0; ObjID < window.Form1.elements.length; ObjID++)
    if ( window.Form1.elements[ObjID].name == ObjName )
    {  return(ObjID);
       break;
    }
  return(-1);
}
function ChangeOption(ObjName, DesName)
{
  //GET OBJECT VALUE, ID OF DESTINATION OBJECT
  ObjID    = GetObjID(ObjName);
  DesObjID = GetObjID(DesName);
  if ( ObjID != -1 && DesObjID != -1 )
  {
    CatValue = window.Form1.elements[ObjID].value.substring(0, 2);
    if ( CatValue == "0" )
      document.Form1.elements[DesObjID].length=0;
    else
    { //PARSING
      document.Form1.elements[DesObjID].length=0;
      var tt = document.Form1.AreaCode.value;
      var SubCategory = tt.split(";");
      //GENERATE OPTIONS
      j=0;
      for (var i=0; i< SubCategory.length; i++ )
      { pp = SubCategory[i].split(",");
        if ( pp[0].substring(0,2) == CatValue )
        {  if ( pp[0].substring(0,2) == CatValue)
           {  document.Form1.elements[DesObjID].options[j]= new Option( pp[1], pp[0]);
              j++;
           }
        }
      }
    }
  }
}

</SCRIPT>

  <FORM method=post name=Form1>
<INPUT name=AreaCode type=hidden
      value=0101,郑州;0102,洛阳;0103,安阳;0104,新乡;0105,鹤壁;0106,南阳;0107,濮阳;0108,开封;0109,商丘;0110,平顶山;0111,周口;0112,三门峡;0113,驻马店;0114,信阳;0115,焦作;0116,漯河;0117,许昌;0118,济源;0119,巩义;0120,登封;0121,荥阳;0122,新密;0123,新郑;0124,上街;0125,中牟;0200,北京;0300,河北;0400,山西;0500,内蒙古;0600,辽宁;0700,吉林;0800,黑龙江;0900,江苏;1000,浙江;1100,安徽;1200,福建;1300,上海;1400,山东;1500,天津;1600,湖北;1700,广东;1800,广西;1900,四川;2000,贵州;2100,云南;2200,西藏;2300,陕西;2400,甘肃;2500,青海;2600,宁夏;2700,新疆;2800,香港;2900,台湾;3000,澳门;3100,江西;3200,重庆;3300,海南;3400,湖南;3500,国外;>
<SELECT name=LocCat onchange="JavaScript:ChangeOption(@#LocCat@#, @#Location@#)" >
<option selected value="">-请选择-</option>
<%for i=1 to ubound(province,1)%>
<option value=<%=province(i,1)%>><%=province(i,2)%></option>
<%next%>
              </SELECT>
              <SELECT name=Location style="WIDTH: 80px">
                      </SELECT>

  </FORM>

原文转自:http://www.ltesting.net