100分问个简单的问题!!快来帮忙呀!!!!!!!!!!!

yanudd 2004-08-11 10:37:42
我们在一些网站上填所在地区的时候,总是先选择所在省份,然后它就会自动把这个省所管辖的市,在下边的选择所在市,里面显示出来,他可能是用了一个表,把他所有的省市都输入里面,选择省份后触发,检索省份的市,我只知道原理,不知道是怎么做的,可能好多大哥都做过,给个例子帮一下

或者讲一下在选择省份后怎样触发的检索函数的?
...全文
189 点赞 收藏 26
写回复
26 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
yanudd 2004-08-13
真是非常感谢!特别是后面的两位大哥!!
先不揭帖,让别人也可以学习 一下,明天揭帖!111
回复
yanudd 2004-08-12
谢谢呀!
回复
kingapex1 2004-08-12
给个函数吧


//动态改变SmallAreaSelect
function SetSmallAreaSelect(objAreaSelect){

var objSelect = document.myForm.SmallAreaSelect;
objSelect.length=0; //恢复为空
var AreaID = objAreaSelect.options[objAreaSelect.selectedIndex].value;

for(var j =0 ;j<cat.length;j++){
if(cat[j][0]==AreaID){

objSelect.options[objSelect.length] =new Option(cat[j][2],cat[j][1]);

}
}

}
回复
aspczlover 2004-08-12
或者讲一下在选择省份后怎样触发的检索函数的?
---------》
触发事件是onchange

下面这个你看看先
function change(v){
var str="0";
for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));};
var ss=document.getElementById(s[v]);
with(ss){
length = 0;
options[0]=new Option(opt0[v],opt0[v]);
if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
{
if(dsy.Exists(str)){
ar = dsy.Items[str];
//alert(ar.length);
for(i=0;i<ar.length;i++) options[length]=new Option(ar[i],ar[i]);
if(v) options[1].selected = true;
}
}
if(++v<s.length){change(v);}
}
}
回复
gu1dai 2004-08-11
这么多大哥,这么多代码,这么多高手,但是
请告诉我
*
*
*
*
为什么用asp实现语音这么难?



回复
OnlyVB 2004-08-11
二级联动,网上、csdn都有的是,搜索一下,或用楼上各位的!
回复
nodes1.loadXML(xmlstr1);
nodes2.loadXML(xmlstr2);
var select1=document.all("sf");
var select2=document.all("cs");
function dispselect1(){
var root1=nodes1.documentElement;
for (var i=0;i<root1.childNodes.length;i++){
var newOption=document.createElement("OPTION");
newOption.value=root1.childNodes(i).getAttribute("id");
newOption.innerHTML=root1.childNodes(i).getAttribute("Name");
select1.appendChild(newOption);
}
}
dispselect1();
function dispselect2(){
var root2=nodes2.documentElement;
var Critically_ID=select1.options[select1.selectedIndex].value;
var xpath="node[@Critically_ID='"+Critically_ID+"']";
var nodes=root2.selectNodes(xpath);
for (var i=select2.length;i>0;i--){
select2.options(i-1).removeNode();
}
var newOption=document.createElement("OPTION");
newOption.value="0";
newOption.innerHTML="-请选择所在城市-";
select2.appendChild(newOption);
for (var i=0;i<nodes.length;i++){
var newOption=document.createElement("OPTION");
newOption.value=nodes(i).getAttribute("id");
newOption.innerHTML=nodes(i).getAttribute("Name");
select2.appendChild(newOption);
}
}
dispselect2();
</script>
<!--end-->
回复
<node id="321" Name="海口市" Critically_ID="28"/><node id="322" Name="三亚市" Critically_ID="28"/><node id="323" Name="文昌市" Critically_ID="28"/><node id="324" Name="琼海市" Critically_ID="28"/><node id="325" Name="万宁市" Critically_ID="28"/><node id="326" Name="东方市" Critically_ID="28"/><node id="327" Name="儋州市" Critically_ID="28"/><node id="328" Name="五指山" Critically_ID="28"/><node id="329" Name="其它" Critically_ID="28"/><node id="330" Name="渝中区" Critically_ID="29"/><node id="331" Name="大渡口区" Critically_ID="29"/><node id="332" Name="江北区" Critically_ID="29"/><node id="333" Name="沙坪坝区" Critically_ID="29"/><node id="334" Name="九龙坡区" Critically_ID="29"/><node id="335" Name="南岸区" Critically_ID="29"/><node id="336" Name="北碚区" Critically_ID="29"/><node id="337" Name="万盛区" Critically_ID="29"/><node id="338" Name="双桥区" Critically_ID="29"/><node id="339" Name="渝北区" Critically_ID="29"/><node id="340" Name="巴南区" Critically_ID="29"/><node id="341" Name="万州区" Critically_ID="29"/><node id="342" Name="涪陵区" Critically_ID="29"/><node id="343" Name="黔江区" Critically_ID="29"/><node id="344" Name="合川市" Critically_ID="29"/><node id="345" Name="永川市" Critically_ID="29"/><node id="346" Name="江津市" Critically_ID="29"/><node id="347" Name="南川市" Critically_ID="29"/><node id="348" Name="其它" Critically_ID="29"/><node id="349" Name="西安市" Critically_ID="31"/><node id="350" Name="延安市" Critically_ID="31"/><node id="351" Name="铜川市" Critically_ID="31"/><node id="352" Name="渭南市" Critically_ID="31"/><node id="353" Name="临渭区" Critically_ID="31"/><node id="354" Name="咸阳市" Critically_ID="31"/><node id="355" Name="汉中市" Critically_ID="31"/><node id="356" Name="榆林市" Critically_ID="31"/><node id="357" Name="安康市" Critically_ID="31"/><node id="358" Name="汉滨区" Critically_ID="31"/><node id="359" Name="商州区" Critically_ID="31"/><node id="360" Name="其它" Critically_ID="31"/><node id="361" Name="和平区" Critically_ID="32"/><node id="362" Name="河东区" Critically_ID="32"/><node id="363" Name="河西区" Critically_ID="32"/><node id="364" Name="南开区" Critically_ID="32"/><node id="365" Name="河北区" Critically_ID="32"/><node id="366" Name="红桥区" Critically_ID="32"/><node id="367" Name="塘沽区" Critically_ID="32"/><node id="368" Name="汉沽区" Critically_ID="32"/><node id="369" Name="大港区" Critically_ID="32"/><node id="370" Name="东丽区" Critically_ID="32"/><node id="371" Name="西青区" Critically_ID="32"/><node id="372" Name="津南区" Critically_ID="32"/><node id="373" Name="北辰区" Critically_ID="32"/><node id="374" Name="武清区" Critically_ID="32"/><node id="375" Name="其它" Critically_ID="32"/><node id="376" Name="沈阳市" Critically_ID="33"/><node id="377" Name="朝阳市" Critically_ID="33"/><node id="378" Name="阜新市" Critically_ID="33"/><node id="379" Name="铁岭市" Critically_ID="33"/><node id="380" Name="抚顺市" Critically_ID="33"/><node id="381" Name="本溪市" Critically_ID="33"/><node id="382" Name="辽阳市" Critically_ID="33"/><node id="383" Name="鞍山市" Critically_ID="33"/><node id="384" Name="丹东市" Critically_ID="33"/><node id="385" Name="大连市" Critically_ID="33"/><node id="386" Name="营口市" Critically_ID="33"/><node id="387" Name="盘锦市" Critically_ID="33"/><node id="388" Name="锦州市" Critically_ID="33"/><node id="389" Name="葫芦岛市" Critically_ID="33"/><node id="390" Name="其它" Critically_ID="33"/><node id="391" Name="郑州市" Critically_ID="34"/><node id="392" Name="三门峡市" Critically_ID="34"/><node id="393" Name="洛阳市" Critically_ID="34"/><node id="394" Name="焦作市" Critically_ID="34"/><node id="395" Name="新乡市" Critically_ID="34"/><node id="396" Name="鹤壁市" Critically_ID="34"/><node id="397" Name="安阳市" Critically_ID="34"/><node id="398" Name="濮阳市" Critically_ID="34"/><node id="399" Name="开封市" Critically_ID="34"/><node id="400" Name="商丘市" Critically_ID="34"/><node id="401" Name="许昌市" Critically_ID="34"/><node id="402" Name="漯河市" Critically_ID="34"/><node id="403" Name="平顶山市" Critically_ID="34"/><node id="404" Name="南阳市" Critically_ID="34"/><node id="405" Name="信阳市" Critically_ID="34"/><node id="406" Name="周口市" Critically_ID="34"/><node id="407" Name="驻马店市" Critically_ID="34"/><node id="408" Name="济源市" Critically_ID="34"/><node id="409" Name="其它" Critically_ID="34"/><node id="410" Name="南宁市" Critically_ID="35"/><node id="411" Name="桂林市" Critically_ID="35"/><node id="412" Name="柳州市" Critically_ID="35"/><node id="413" Name="梧州市" Critically_ID="35"/><node id="414" Name="钦州市" Critically_ID="35"/><node id="415" Name="贵港市" Critically_ID="35"/><node id="416" Name="玉林市" Critically_ID="35"/><node id="417" Name="北海市" Critically_ID="35"/><node id="418" Name="防城港市" Critically_ID="35"/><node id="419" Name="南宁地区" Critically_ID="35"/><node id="420" Name="百色地区" Critically_ID="35"/><node id="421" Name="河池地区" Critically_ID="35"/><node id="422" Name="柳州地区" Critically_ID="35"/><node id="423" Name="贺州地区" Critically_ID="35"/><node id="424" Name="其它" Critically_ID="35"/><node id="425" Name="广洲市" Critically_ID="36"/><node id="426" Name="深圳市" Critically_ID="36"/><node id="427" Name="南海市" Critically_ID="36"/><node id="428" Name="惠洲市" Critically_ID="36"/><node id="429" Name="东莞市" Critically_ID="36"/><node id="430" Name="顺德市" Critically_ID="36"/><node id="431" Name="番禺市" Critically_ID="36"/><node id="432" Name="佛山市" Critically_ID="36"/><node id="433" Name="鹤山市" Critically_ID="36"/><node id="434" Name="南雄市" Critically_ID="36"/><node id="435" Name="连州市" Critically_ID="36"/><node id="436" Name="揭阳市 " Critically_ID="36"/><node id="437" Name="河源市" Critically_ID="36"/><node id="438" Name="潮阳市" Critically_ID="36"/><node id="439" Name="陆丰市" Critically_ID="36"/><node id="440" Name="汕尾市" Critically_ID="36"/><node id="441" Name="台山市" Critically_ID="36"/><node id="442" Name="湛江市" Critically_ID="36"/><node id="443" Name="其它" Critically_ID="36"/><node id="445" Name="福州市" Critically_ID="37"/><node id="446" Name="三明市" Critically_ID="37"/><node id="447" Name="莆田市" Critically_ID="37"/><node id="448" Name="泉州市" Critically_ID="37"/><node id="449" Name="厦门市" Critically_ID="37"/><node id="450" Name="漳州市" Critically_ID="37"/><node id="451" Name="龙岩市" Critically_ID="37"/><node id="452" Name="宁德市" Critically_ID="37"/><node id="453" Name="其它" Critically_ID="37"/><node id="454" Name="南京市" Critically_ID="38"/><node id="455" Name="徐州市" Critically_ID="38"/><node id="456" Name="连云港市" Critically_ID="38"/><node id="457" Name="宿迁市" Critically_ID="38"/><node id="458" Name="淮安市" Critically_ID="38"/><node id="459" Name="盐城市" Critically_ID="38"/><node id="460" Name="扬州市" Critically_ID="38"/><node id="461" Name="泰州市" Critically_ID="38"/><node id="462" Name="南通市" Critically_ID="38"/><node id="463" Name="镇江市" Critically_ID="38"/><node id="464" Name="常州市" Critically_ID="38"/><node id="465" Name="无锡市" Critically_ID="38"/><node id="466" Name="苏州市" Critically_ID="38"/><node id="467" Name="其它" Critically_ID="38"/><node id="468" Name="其它地区" Critically_ID="39"/><node id="469" Name="30" Critically_ID="0"/><node id="470" Name="1" Critically_ID="0"/></root>';
回复
lovecd 2004-08-11


最完整的省市县三级联动,用这个比较好,可下载:

http://fason.nease.net/samples/bigarea/
回复
<node id="147" Name="武汉市" Critically_ID="15"/><node id="148" Name="十堰市" Critically_ID="15"/><node id="149" Name="囊樊市" Critically_ID="15"/><node id="150" Name="荆门市" Critically_ID="15"/><node id="151" Name="孝感市" Critically_ID="15"/><node id="152" Name="黄冈市" Critically_ID="15"/><node id="153" Name="鄂州市" Critically_ID="15"/><node id="154" Name="黄石市" Critically_ID="15"/><node id="155" Name="咸宁市" Critically_ID="15"/><node id="156" Name="荆州市" Critically_ID="15"/><node id="157" Name="宜昌市" Critically_ID="15"/><node id="158" Name="随州市" Critically_ID="15"/><node id="159" Name="其它" Critically_ID="15"/><node id="160" Name="长沙市" Critically_ID="16"/><node id="161" Name="张家界市" Critically_ID="16"/><node id="162" Name="常德市" Critically_ID="16"/><node id="163" Name="益阳市" Critically_ID="16"/><node id="164" Name="岳阳市" Critically_ID="16"/><node id="165" Name="株洲市" Critically_ID="16"/><node id="166" Name="湘潭市" Critically_ID="16"/><node id="167" Name="衡阳市" Critically_ID="16"/><node id="168" Name="郴州市" Critically_ID="16"/><node id="169" Name="永州市" Critically_ID="16"/><node id="170" Name="邵阳市" Critically_ID="16"/><node id="171" Name="怀化市" Critically_ID="16"/><node id="172" Name="娄底市" Critically_ID="16"/><node id="173" Name="湘西土家族苗族自治州" Critically_ID="16"/><node id="174" Name="其它" Critically_ID="16"/><node id="175" Name="贵阳市" Critically_ID="17"/><node id="176" Name="六盘水市" Critically_ID="17"/><node id="177" Name="遵义市" Critically_ID="17"/><node id="178" Name="安顺市" Critically_ID="17"/><node id="179" Name="毕节地区" Critically_ID="17"/><node id="180" Name="铜仁地区" Critically_ID="17"/><node id="181" Name="黔东南苗族侗族自治县" Critically_ID="17"/><node id="182" Name="黔南布依族苗族自治州" Critically_ID="17"/><node id="183" Name="黔西南布依族苗族自治州" Critically_ID="17"/><node id="184" Name="其它" Critically_ID="17"/><node id="185" Name="昆明市" Critically_ID="18"/><node id="186" Name="曲靖市" Critically_ID="18"/><node id="187" Name="玉溪市" Critically_ID="18"/><node id="188" Name="保山市" Critically_ID="18"/><node id="189" Name="丽江地区" Critically_ID="18"/><node id="190" Name="昭通地区" Critically_ID="18"/><node id="191" Name="思茅地区" Critically_ID="18"/><node id="192" Name="临沧地区" Critically_ID="18"/><node id="193" Name="德宏傣族景颇族自治州" Critically_ID="18"/><node id="194" Name="怒江傈僳族自治州" Critically_ID="18"/><node id="195" Name="迪庆藏族自治州" Critically_ID="18"/><node id="196" Name="大理白族自治州" Critically_ID="18"/><node id="197" Name="楚雄彝族自治州" Critically_ID="18"/><node id="198" Name="红河哈尼族彝族自治州" Critically_ID="18"/><node id="199" Name="其它" Critically_ID="18"/><node id="200" Name="拉萨市" Critically_ID="19"/><node id="201" Name="那曲地区" Critically_ID="19"/><node id="202" Name="昌都地区" Critically_ID="19"/><node id="203" Name="林芝地区" Critically_ID="19"/><node id="204" Name="山南地区" Critically_ID="19"/><node id="205" Name="日喀则地区" Critically_ID="19"/><node id="206" Name="阿里地区" Critically_ID="19"/><node id="207" Name="其它" Critically_ID="19"/><node id="208" Name="兰州市" Critically_ID="20"/><node id="209" Name="嘉峪关市" Critically_ID="20"/><node id="210" Name="金昌市" Critically_ID="20"/><node id="211" Name="天水市" Critically_ID="20"/><node id="212" Name="酒泉地区" Critically_ID="20"/><node id="213" Name="张掖地区" Critically_ID="20"/><node id="214" Name="武威地区" Critically_ID="20"/><node id="215" Name="庆阳地区" Critically_ID="20"/><node id="216" Name="平凉地区" Critically_ID="20"/><node id="217" Name="定西地区" Critically_ID="20"/><node id="218" Name="陇南地区" Critically_ID="20"/><node id="219" Name="临夏回族自治州" Critically_ID="20"/><node id="220" Name="甘南藏族自治州" Critically_ID="20"/><node id="221" Name="其它" Critically_ID="20"/><node id="222" Name="西宁市" Critically_ID="21"/><node id="223" Name="海东地区" Critically_ID="21"/><node id="224" Name="海北藏族自治州" Critically_ID="21"/><node id="225" Name="海南藏族自治州" Critically_ID="21"/><node id="226" Name="黄南藏族自治州" Critically_ID="21"/><node id="227" Name="果洛藏族自治州" Critically_ID="21"/><node id="228" Name="玉树藏族自治州" Critically_ID="21"/><node id="229" Name="海西蒙古族藏族自治州" Critically_ID="21"/><node id="230" Name="其它" Critically_ID="21"/><node id="231" Name="银川市" Critically_ID="22"/><node id="232" Name="石嘴山市" Critically_ID="22"/><node id="233" Name="吴忠市" Critically_ID="22"/><node id="234" Name="固原地区" Critically_ID="22"/><node id="235" Name="其它" Critically_ID="22"/><node id="236" Name="乌鲁木齐市" Critically_ID="23"/><node id="237" Name="克拉玛依市" Critically_ID="23"/><node id="238" Name="石河子市" Critically_ID="23"/><node id="239" Name="喀什市" Critically_ID="23"/><node id="240" Name="阿克苏市" Critically_ID="23"/><node id="241" Name="和田市" Critically_ID="23"/><node id="242" Name="吐鲁番市" Critically_ID="23"/><node id="243" Name="哈密市" Critically_ID="23"/><node id="244" Name="阿图什市" Critically_ID="23"/><node id="245" Name="博乐市" Critically_ID="23"/><node id="246" Name="昌吉市" Critically_ID="23"/><node id="247" Name="库尔勒市" Critically_ID="23"/><node id="248" Name="奎屯市" Critically_ID="23"/><node id="249" Name="伊宁市" Critically_ID="23"/><node id="250" Name="塔城市" Critically_ID="23"/><node id="251" Name="阿勒泰市" Critically_ID="23"/><node id="252" Name="其它 " Critically_ID="23"/><node id="253" Name="成都市" Critically_ID="24"/><node id="254" Name="彭州市" Critically_ID="24"/><node id="255" Name="广元市" Critically_ID="24"/><node id="256" Name="绵阳市" Critically_ID="24"/><node id="257" Name="德阳市" Critically_ID="24"/><node id="258" Name="南充市" Critically_ID="24"/><node id="259" Name="广安市" Critically_ID="24"/><node id="260" Name="遂宁市" Critically_ID="24"/><node id="261" Name="内江市" Critically_ID="24"/><node id="262" Name="乐山市" Critically_ID="24"/><node id="263" Name="自贡市" Critically_ID="24"/><node id="264" Name="泸州市" Critically_ID="24"/><node id="265" Name="攀枝花市" Critically_ID="24"/><node id="266" Name="巴中市" Critically_ID="24"/><node id="267" Name="达州市" Critically_ID="24"/><node id="268" Name="资阳市" Critically_ID="24"/><node id="269" Name="眉山市" Critically_ID="24"/><node id="270" Name="雅安市" Critically_ID="24"/><node id="271" Name="阿坝藏族羌族自治州" Critically_ID="24"/><node id="272" Name="甘孜藏族自治州" Critically_ID="24"/><node id="273" Name="凉山彝族自治州" Critically_ID="24"/><node id="274" Name="其它 " Critically_ID="24"/><node id="275" Name="中西区" Critically_ID="25"/><node id="276" Name="东区" Critically_ID="25"/><node id="277" Name="九龙城区" Critically_ID="25"/><node id="278" Name="观塘区" Critically_ID="25"/><node id="279" Name="南区" Critically_ID="25"/><node id="280" Name="湾仔区" Critically_ID="25"/><node id="281" Name="黄大仙区" Critically_ID="25"/><node id="282" Name="油尖旺区" Critically_ID="25"/><node id="283" Name="离岛区" Critically_ID="25"/><node id="284" Name="葵青区" Critically_ID="25"/><node id="285" Name="北区" Critically_ID="25"/><node id="286" Name="西贡区" Critically_ID="25"/><node id="287" Name="沙田区" Critically_ID="25"/><node id="288" Name="屯门区" Critically_ID="25"/><node id="289" Name="大埔区" Critically_ID="25"/><node id="290" Name="荃湾区" Critically_ID="25"/><node id="291" Name="元朗区" Critically_ID="25"/><node id="292" Name="九龙" Critically_ID="25"/><node id="293" Name="其它" Critically_ID="25"/><node id="294" Name="高雄" Critically_ID="26"/><node id="295" Name="台北" Critically_ID="26"/><node id="296" Name="台中" Critically_ID="26"/><node id="297" Name="其它" Critically_ID="26"/><node id="298" Name="澳门市" Critically_ID="27"/><node id="299" Name="其它" Critically_ID="27"/>to be continue……对不起,回复不了第四次了
回复
var xmlstr2='<root success="true"><node id="1" Name="海淀区" Critically_ID="1"/><node id="3" Name="石景山区" Critically_ID="1"/><node id="4" Name="丰台区" Critically_ID="1"/><node id="5" Name="西城区" Critically_ID="1"/><node id="6" Name="宣武区" Critically_ID="1"/><node id="7" Name="东城区" Critically_ID="1"/><node id="8" Name="崇文区" Critically_ID="1"/><node id="9" Name="朝阳区" Critically_ID="1"/><node id="10" Name="昌平" Critically_ID="1"/><node id="11" Name="大兴" Critically_ID="1"/><node id="12" Name="房山" Critically_ID="1"/><node id="13" Name="怀柔" Critically_ID="1"/><node id="14" Name="门头沟" Critically_ID="1"/><node id="15" Name="平谷" Critically_ID="1"/><node id="16" Name="顺义" Critically_ID="1"/><node id="17" Name="通州" Critically_ID="1"/><node id="18" Name="密云" Critically_ID="1"/><node id="19" Name="其它" Critically_ID="1"/><node id="20" Name="黄浦区" Critically_ID="2"/><node id="21" Name="卢湾区" Critically_ID="2"/><node id="22" Name="徐汇区" Critically_ID="2"/><node id="23" Name="长宁区" Critically_ID="2"/><node id="24" Name="静安区" Critically_ID="2"/><node id="25" Name="普陀区" Critically_ID="2"/><node id="26" Name="闸北区" Critically_ID="2"/><node id="27" Name="虹口区" Critically_ID="2"/><node id="28" Name="杨浦区" Critically_ID="2"/><node id="29" Name="闵行区" Critically_ID="2"/><node id="30" Name="浦东新区" Critically_ID="2"/><node id="31" Name="南汇区" Critically_ID="2"/><node id="35" Name="其它" Critically_ID="2"/><node id="36" Name="石家庄市" Critically_ID="3"/><node id="37" Name="张家口" Critically_ID="3"/><node id="38" Name="承德市" Critically_ID="3"/><node id="39" Name="秦皇岛市" Critically_ID="3"/><node id="40" Name="唐山市" Critically_ID="3"/><node id="41" Name="廊坊市" Critically_ID="3"/><node id="42" Name="沧州市" Critically_ID="3"/><node id="43" Name="衡水市" Critically_ID="3"/><node id="44" Name="其它" Critically_ID="3"/><node id="45" Name="太原市" Critically_ID="7"/><node id="46" Name="大同市" Critically_ID="7"/><node id="47" Name="朔州市" Critically_ID="7"/><node id="48" Name="阳泉市" Critically_ID="7"/><node id="49" Name="晋城市" Critically_ID="7"/><node id="50" Name="忻州市" Critically_ID="7"/><node id="51" Name="晋中市" Critically_ID="7"/><node id="52" Name="临汾市" Critically_ID="7"/><node id="53" Name="运城市" Critically_ID="7"/><node id="54" Name="吕梁地区" Critically_ID="7"/><node id="55" Name="其它" Critically_ID="7"/><node id="56" Name="呼和浩特市" Critically_ID="8"/><node id="57" Name="包头市" Critically_ID="8"/><node id="58" Name="乌海市" Critically_ID="8"/><node id="59" Name="赤峰市" Critically_ID="8"/><node id="60" Name="通辽市" Critically_ID="8"/><node id="61" Name="呼伦贝尔盟" Critically_ID="8"/><node id="62" Name="兴安盟" Critically_ID="8"/><node id="63" Name="锡林郭勒盟" Critically_ID="8"/><node id="64" Name="乌兰察布盟" Critically_ID="8"/><node id="65" Name="伊克昭盟" Critically_ID="8"/><node id="66" Name="巴彦淖尔萌" Critically_ID="8"/><node id="67" Name="阿拉善盟" Critically_ID="8"/><node id="68" Name="其它 " Critically_ID="8"/><node id="69" Name="长春市" Critically_ID="9"/><node id="70" Name="白城市" Critically_ID="9"/><node id="71" Name="松原市" Critically_ID="9"/><node id="72" Name="吉林市" Critically_ID="9"/><node id="73" Name="四平市" Critically_ID="9"/><node id="74" Name="辽源市" Critically_ID="9"/><node id="75" Name="通化市" Critically_ID="9"/><node id="76" Name="白山市" Critically_ID="9"/><node id="77" Name="延边朝鲜族自治州" Critically_ID="9"/><node id="78" Name="其它" Critically_ID="9"/><node id="79" Name="哈尔滨市" Critically_ID="10"/><node id="80" Name="齐齐哈尔市" Critically_ID="10"/><node id="81" Name="黑河市" Critically_ID="10"/><node id="82" Name="大庆市" Critically_ID="10"/><node id="83" Name="伊春市" Critically_ID="10"/><node id="84" Name="鹤岗市" Critically_ID="10"/><node id="85" Name="佳木斯市" Critically_ID="10"/><node id="86" Name="双鸭山市" Critically_ID="10"/><node id="87" Name="七台河市" Critically_ID="10"/><node id="88" Name="鸡西市" Critically_ID="10"/><node id="89" Name="牡丹江市" Critically_ID="10"/><node id="90" Name="绥化市" Critically_ID="10"/><node id="91" Name="其它" Critically_ID="10"/><node id="92" Name="杭州市" Critically_ID="11"/><node id="93" Name="湖州市" Critically_ID="11"/><node id="94" Name="嘉兴市" Critically_ID="11"/><node id="95" Name="舟山市" Critically_ID="11"/><node id="96" Name="宁波市" Critically_ID="11"/><node id="97" Name="绍兴市" Critically_ID="11"/><node id="98" Name="衢州市" Critically_ID="11"/><node id="99" Name="金华市" Critically_ID="11"/><node id="100" Name="台州市" Critically_ID="11"/><node id="101" Name="温州市" Critically_ID="11"/><node id="102" Name="丽水市" Critically_ID="11"/><node id="103" Name="其它" Critically_ID="11"/><node id="104" Name="合肥市" Critically_ID="12"/><node id="105" Name="淮北市" Critically_ID="12"/><node id="106" Name="亳州市" Critically_ID="12"/><node id="107" Name="淮南市" Critically_ID="12"/><node id="108" Name="滁州市" Critically_ID="12"/><node id="109" Name="马鞍山市" Critically_ID="12"/><node id="110" Name="芜湖市" Critically_ID="12"/><node id="111" Name="铜陵市" Critically_ID="12"/><node id="112" Name="安庆市" Critically_ID="12"/><node id="113" Name="黄山市" Critically_ID="12"/><node id="114" Name="巢湖市" Critically_ID="12"/><node id="115" Name="池州市" Critically_ID="12"/><node id="116" Name="宣城市" Critically_ID="12"/><node id="117" Name="其它" Critically_ID="12"/><node id="118" Name="南昌市" Critically_ID="13"/><node id="119" Name="九江市" Critically_ID="13"/><node id="120" Name="景德镇市" Critically_ID="13"/><node id="121" Name="鹰潭市" Critically_ID="13"/><node id="122" Name="新余市" Critically_ID="13"/><node id="123" Name="萍乡市" Critically_ID="13"/><node id="124" Name="漳州市" Critically_ID="13"/><node id="125" Name="上饶市" Critically_ID="13"/><node id="126" Name="抚州市" Critically_ID="13"/><node id="127" Name="宜春市" Critically_ID="13"/><node id="128" Name="吉安市" Critically_ID="13"/><node id="129" Name="其它" Critically_ID="13"/><node id="130" Name="济南市" Critically_ID="14"/><node id="131" Name="德州市" Critically_ID="14"/><node id="132" Name="东营市" Critically_ID="14"/><node id="133" Name="淄博市" Critically_ID="14"/><node id="134" Name="潍坊市" Critically_ID="14"/><node id="135" Name="烟台市" Critically_ID="14"/><node id="136" Name="威海市" Critically_ID="14"/><node id="137" Name="青岛市" Critically_ID="14"/><node id="138" Name="日照市" Critically_ID="14"/><node id="139" Name="临沂市" Critically_ID="14"/><node id="140" Name="枣庄市" Critically_ID="14"/><node id="141" Name="济宁市" Critically_ID="14"/><node id="142" Name="泰安市" Critically_ID="14"/><node id="143" Name="莱芜市" Critically_ID="14"/><node id="144" Name="滨州市" Critically_ID="14"/><node id="145" Name="菏泽市" Critically_ID="14"/><node id="146" Name="其它" Critically_ID="14"/>
回复
<table>
<tr>
<td height="22" align="right"><font color="#FF0000">*</font>所在省份:</td>
<td height="22"><SELECT name="sf" size="1" class="input" id="sf" tabIndex="14" onchange="dispselect2()">
<OPTION selected value="0">请选择所在省份</OPTION>
</SELECT></td>
</tr>
<tr>
<td height="22" align="right"><font color="#FF0000">*</font>所在城市:</td>
<td height="22"><SELECT name="cs" size="1" class="input" id="cs" tabIndex="14">
<OPTION selected value="0">请选择所在城市</OPTION>
</SELECT></td>
</tr>
</table>
<script language="javascript">
var nodes1=new ActiveXObject("msxml2.domdocument");
var nodes2=new ActiveXObject("msxml2.domdocument");
var xmlstr1='<root success="true"><node id="1" Name="北京市"/><node id="2" Name="上海市"/><node id="3" Name="河北省"/><node id="7" Name="山西省"/><node id="8" Name="内蒙古自治区"/><node id="9" Name="吉林省"/><node id="10" Name="黑龙江省"/><node id="11" Name="浙江省"/><node id="12" Name="安徽省"/><node id="13" Name="江西省"/><node id="14" Name="山东省"/><node id="15" Name="湖北省"/><node id="16" Name="湖南省"/><node id="17" Name="贵州省"/><node id="18" Name="云南省"/><node id="19" Name="西藏自治区"/><node id="20" Name="甘肃省"/><node id="21" Name="青海省"/><node id="22" Name="宁夏自治区"/><node id="23" Name="新疆自治区"/><node id="24" Name="四川省"/><node id="25" Name="香港特别行政区"/><node id="26" Name="台湾省"/><node id="27" Name="澳门特别行政区"/><node id="28" Name="海南省"/><node id="29" Name="重庆市"/><node id="31" Name="陕西省"/><node id="32" Name="天津市"/><node id="33" Name="辽宁省"/><node id="34" Name="河南省"/><node id="35" Name="广西省"/><node id="36" Name="广东省"/><node id="37" Name="福建省"/><node id="38" Name="江苏省"/><node id="39" Name="其它"/></root>';
回复
完全通过js的也可以实现,不过确实很多代码,就象楼上整的~~~~~~

看看这几个参考~
http://www.51windows.net/hw/asp/jsview.asp?id=347

http://www.51windows.net/hw/asp/jsview.asp?id=99

http://computer.mblogger.cn/onion/posts/12370.aspx


回复
xcgh 2004-08-11
http://code365.com/今天刚看到的
回复
顺子 2004-08-11
強!!
回复
sheng9hhd 2004-08-11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<HEAD>
<script language="javascript">
<!--
var where = new Array(36);
function comefrom(loca,locacity) { this.loca = loca; this.locacity = locacity; }
where[0]= new comefrom("请选择省份名","请选择城市名");
where[1] = new comefrom("北京","|东城|西城|崇文|宣武|朝阳|丰台|石景山|海淀|门头沟|房山|通州|顺义|昌平|大兴|平谷|怀柔|密云|延庆");
where[2] = new comefrom("上海","|黄浦|卢湾|徐汇|长宁|静安|普陀|闸北|虹口|杨浦|闵行|宝山|嘉定|浦东|金山|松江|青浦|南汇|奉贤|崇明");
where[3] = new comefrom("天津","|和平|东丽|河东|西青|河西|津南|南开|北辰|河北|武清|红挢|塘沽|汉沽|大港|宁河|静海|宝坻|蓟县");
where[4] = new comefrom("重庆","|万州|涪陵|渝中|大渡口|江北|沙坪坝|九龙坡|南岸|北碚|万盛|双挢|渝北|巴南|黔江|长寿|綦江|潼南|铜梁|大足|荣昌|壁山|梁平|城口|丰都|垫江|武隆|忠县|开县|云阳|奉节|巫山|巫溪|石柱|秀山|酉阳|彭水|江津|合川|永川|南川");
where[5] = new comefrom("河北","|石家庄|邯郸|邢台|保定|张家口|承德|廊坊|唐山|秦皇岛|沧州|衡水");
where[6] = new comefrom("山西","|太原|大同|阳泉|长治|晋城|朔州|吕梁|忻州|晋中|临汾|运城");
where[7] = new comefrom("内蒙古","|呼和浩特|包头|乌海|赤峰|呼伦贝尔盟|阿拉善盟|哲里木盟|兴安盟|乌兰察布盟|锡林郭勒盟|巴彦淖尔盟|伊克昭盟");
where[8] = new comefrom("辽宁","|沈阳|大连|鞍山|抚顺|本溪|丹东|锦州|营口|阜新|辽阳|盘锦|铁岭|朝阳|葫芦岛");
where[9] = new comefrom("吉林","|长春|吉林|四平|辽源|通化|白山|松原|白城|延边");
where[10] = new comefrom("黑龙江","|哈尔滨|齐齐哈尔|牡丹江|佳木斯|大庆|绥化|鹤岗|鸡西|黑河|双鸭山|伊春|七台河|大兴安岭");
where[11] = new comefrom("江苏","|南京|镇江|苏州|南通|扬州|盐城|徐州|连云港|常州|无锡|宿迁|泰州|淮安|丹徒|丹阳|张家港|太仓|昆山|吴江|海门|如皋|如东|扬中|东台|溧阳|武进|江阴|锡山|宜兴|金坛");
where[12] = new comefrom("浙江","|杭州|宁波|温州|嘉兴|湖州|绍兴|金华|衢州|舟山|台州|丽水");
where[13] = new comefrom("安徽","|合肥|芜湖|蚌埠|马鞍山|淮北|铜陵|安庆|黄山|滁州|宿州|池州|淮南|巢湖|阜阳|六安|宣城|亳州");
where[14] = new comefrom("福建","|福州|厦门|莆田|三明|泉州|漳州|南平|龙岩|宁德");
where[15] = new comefrom("江西","|南昌市|景德镇|九江|鹰潭|萍乡|新馀|赣州|吉安|宜春|抚州|上饶");
where[16] = new comefrom("山东","|济南|青岛|淄博|枣庄|东营|烟台|潍坊|济宁|泰安|威海|日照|莱芜|临沂|德州|聊城|滨州|菏泽");
where[17] = new comefrom("河南","|郑州|开封|洛阳|平顶山|安阳|鹤壁|新乡|焦作|濮阳|许昌|漯河|三门峡|南阳|商丘|信阳|周口|驻马店|济源");
where[18] = new comefrom("湖北","|武汉|宜昌|荆州|襄樊|黄石|荆门|黄冈|十堰|恩施|潜江|天门|仙桃|随州|咸宁|孝感|鄂州");
where[19] = new comefrom("湖南","|长沙|常德|株洲|湘潭|衡阳|岳阳|邵阳|益阳|娄底|怀化|郴州|永州|湘西|张家界");
where[20] = new comefrom("广东","|广州|深圳|珠海|汕头|东莞|中山|佛山|韶关|江门|湛江|茂名|肇庆|惠州|梅州|汕尾|河源|阳江|清远|潮州|揭阳|云浮");
where[21] = new comefrom("广西","|南宁|柳州|桂林|梧州|北海|防城港|钦州|贵港|玉林|南宁地区|柳州地区|贺州|百色|河池");
where[22] = new comefrom("海南","|海口|三亚");
where[23] = new comefrom("四川","|成都|绵阳|德阳|自贡|攀枝花|广元|内江|乐山|南充|宜宾|广安|达川|雅安|眉山|甘孜|凉山|泸州");
where[24] = new comefrom("贵州","|贵阳|六盘水|遵义|安顺|铜仁|黔西南|毕节|黔东南|黔南");
where[25] = new comefrom("云南","|昆明|大理|曲靖|玉溪|昭通|楚雄|红河|文山|思茅|西双版纳|保山|德宏|丽江|怒江|迪庆|临沧");
where[26] = new comefrom("西藏","|拉萨|日喀则|山南|林芝|昌都|阿里|那曲");
where[27] = new comefrom("陕西","|西安|宝鸡|咸阳|铜川|渭南|延安|榆林|汉中|安康|商洛");
where[28] = new comefrom("甘肃","|兰州|嘉峪关|金昌|白银|天水|酒泉|张掖|武威|定西|陇南|平凉|庆阳|临夏|甘南");
where[29] = new comefrom("宁夏","|银川|石嘴山|吴忠|固原");
where[30] = new comefrom("青海","|西宁|海东|海南|海北|黄南|玉树|果洛|海西");
where[31] = new comefrom("新疆","|乌鲁木齐|石河子|克拉玛依|伊犁|巴音郭勒|昌吉|克孜勒苏柯尔克孜|博尔塔拉|吐鲁番|哈密|喀什|和田|阿克苏");
where[32] = new comefrom("香港","");
where[33] = new comefrom("澳门","");
where[34] = new comefrom("台湾","|台北|高雄|台中|台南|屏东|南投|云林|新竹|彰化|苗栗|嘉义|花莲|桃园|宜兰|基隆|台东|金门|马祖|澎湖");
where[35] = new comefrom("国外","|北美洲|南美洲|亚洲|非洲|欧洲|大洋洲");
function select() {
with(document.creator.province) { var loca2 = options[selectedIndex].value; }
for(i = 0;i < where.length;i ++) {
if (where[i].loca == loca2) {
loca3 = (where[i].locacity).split("|");
for(j = 0;j < loca3.length;j++) { with(document.creator.city) { length = loca3.length;
options[j].text = loca3[j]; options[j].value = loca3[j]; var
loca4=options[selectedIndex].value;}}
break;
}}
document.creator.address.value=loca2+loca4;
}
function init() {
with(document.creator.province) {
length = where.length;
for(k=0;k<where.length;k++) { options[k].text = where[k].loca; options[k].value =
where[k].loca; }
options[selectedIndex].text = where[0].loca; options[selectedIndex].value = where[0].loca;
}
with(document.creator.city) {
loca3 = (where[0].locacity).split("|");
length = loca3.length;
for(l=0;l<length;l++) { options[l].text = loca3[l]; options[l].value = loca3[l]; }
options[selectedIndex].text = loca3[0]; options[selectedIndex].value = loca3[0];
}}
-->
</script>
</head>

<BODY onload="init();">
<form name="creator" action=zc21.asp method=post onSubmit="return checkReg()">
<select name="province" onChange = "select()"></select>
<select name="city" onChange = "select()"></select>
<select name="address"></select>
</form>
</body>
</html>
回复
tthan1 2004-08-11
也可以在选项1的onChange事件写相应的程序,
回复
ycted 2004-08-11
给个不要数据库的.
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

var where = new Array(35);
function comefrom(loca,locacity) { this.loca = loca; this.locacity = locacity; }

where[0] = new comefrom("福建","泉州|福州|厦门|莆田|三明|漳州|南平|龙岩|宁德");
where[1] = new comefrom("北京","东城|西城|崇文|宣武|朝阳|丰台|石景山|海淀|门头沟|房山|通州|顺义|昌平|大兴|平谷|怀柔|密云|延庆");
where[2] = new comefrom("上海","黄浦|卢湾|徐汇|长宁|静安|普陀|闸北|虹口|杨浦|闵行|宝山|嘉定|浦东|金山|松江|青浦|南汇|奉贤|崇明");
where[3] = new comefrom("天津","和平|东丽|河东|西青|河西|津南|南开|北辰|河北|武清|红挢|塘沽|汉沽|大港|宁河|静海|宝坻|蓟县");
where[4] = new comefrom("重庆","万州|涪陵|渝中|大渡口|江北|沙坪坝|九龙坡|南岸|北碚|万盛|双挢|渝北|巴南|黔江|长寿|綦江|潼南|铜梁|大足|荣昌|壁山|梁平|城口|丰都|垫江|武隆|忠县|开县|云阳|奉节|巫山|巫溪|石柱|秀山|酉阳|彭水|江津|合川|永川|南川");
where[5] = new comefrom("河北","石家庄|邯郸|邢台|保定|张家口|承德|廊坊|唐山|秦皇岛|沧州|衡水");
where[6] = new comefrom("山西","太原|大同|阳泉|长治|晋城|朔州|吕梁|忻州|晋中|临汾|运城");
where[7] = new comefrom("内蒙古","呼和浩特|包头|乌海|赤峰|呼伦贝尔盟|阿拉善盟|哲里木盟|兴安盟|乌兰察布盟|锡林郭勒盟|巴彦淖尔盟|伊克昭盟");
where[8] = new comefrom("辽宁","沈阳|大连|鞍山|抚顺|本溪|丹东|锦州|营口|阜新|辽阳|盘锦|铁岭|朝阳|葫芦岛");
where[9] = new comefrom("吉林","长春|吉林|四平|辽源|通化|白山|松原|白城|延边");
where[10] = new comefrom("黑龙江","哈尔滨|齐齐哈尔|牡丹江|佳木斯|大庆|绥化|鹤岗|鸡西|黑河|双鸭山|伊春|七台河|大兴安岭");
where[11] = new comefrom("江苏","南京|镇江|苏州|南通|扬州|盐城|徐州|连云港|常州|无锡|宿迁|泰州|淮安");
where[12] = new comefrom("浙江","杭州|宁波|温州|嘉兴|湖州|绍兴|金华|衢州|舟山|台州|丽水");
where[13] = new comefrom("安徽","合肥|芜湖|蚌埠|马鞍山|淮北|铜陵|安庆|黄山|滁州|宿州|池州|淮南|巢湖|阜阳|六安|宣城|亳州");
where[14] = new comefrom("江西","南昌市|景德镇|九江|鹰潭|萍乡|新馀|赣州|吉安|宜春|抚州|上饶");
where[15] = new comefrom("山东","济南|青岛|淄博|枣庄|东营|烟台|潍坊|济宁|泰安|威海|日照|莱芜|临沂|德州|聊城|滨州|菏泽");
where[16] = new comefrom("河南","郑州|开封|洛阳|平顶山|安阳|鹤壁|新乡|焦作|濮阳|许昌|漯河|三门峡|南阳|商丘|信阳|周口|驻马店|济源");
where[17] = new comefrom("湖北","武汉|宜昌|荆州|襄樊|黄石|荆门|黄冈|十堰|恩施|潜江|天门|仙桃|随州|咸宁|孝感|鄂州");
where[18] = new comefrom("湖南","长沙|常德|株洲|湘潭|衡阳|岳阳|邵阳|益阳|娄底|怀化|郴州|永州|湘西|张家界");
where[19] = new comefrom("广东","广州|深圳|珠海|汕头|东莞|中山|佛山|韶关|江门|湛江|茂名|肇庆|惠州|梅州|汕尾|河源|阳江|清远|潮州|揭阳|云浮");
where[20] = new comefrom("广西","南宁|柳州|桂林|梧州|北海|防城港|钦州|贵港|玉林|南宁地区|柳州地区|贺州|百色|河池");
where[21] = new comefrom("海南","海口|三亚");
where[22] = new comefrom("四川","成都|绵阳|德阳|自贡|攀枝花|广元|内江|乐山|南充|宜宾|广安|达川|雅安|眉山|甘孜|凉山|泸州");
where[23] = new comefrom("贵州","贵阳|六盘水|遵义|安顺|铜仁|黔西南|毕节|黔东南|黔南");
where[24] = new comefrom("云南","昆明|大理|曲靖|玉溪|昭通|楚雄|红河|文山|思茅|西双版纳|保山|德宏|丽江|怒江|迪庆|临沧");
where[25] = new comefrom("西藏","拉萨|日喀则|山南|林芝|昌都|阿里|那曲");
where[26] = new comefrom("陕西","西安|宝鸡|咸阳|铜川|渭南|延安|榆林|汉中|安康|商洛");
where[27] = new comefrom("甘肃","兰州|嘉峪关|金昌|白银|天水|酒泉|张掖|武威|定西|陇南|平凉|庆阳|临夏|甘南");
where[28] = new comefrom("宁夏","银川|石嘴山|吴忠|固原");
where[29] = new comefrom("青海","西宁|海东|海南|海北|黄南|玉树|果洛|海西");
where[30] = new comefrom("新疆","乌鲁木齐|石河子|克拉玛依|伊犁|巴音郭勒|昌吉|克孜勒苏州|博尔塔拉|吐鲁番|哈密|喀什|和田|阿克苏");
where[31] = new comefrom("香港","香港");
where[32] = new comefrom("澳门","澳门");
where[33] = new comefrom("台湾","台北|高雄|台中|台南|屏东|南投|云林|新竹|彰化|苗栗|嘉义|花莲|桃园|宜兰|基隆|台东|金门|马祖|澎湖");
where[34] = new comefrom("其它","北美洲|南美洲|亚洲|非洲|欧洲|大洋洲");


function province()
{var str = new Array();
for ( i=0;i<where.length-1;i++ )
{str[i] = "<option value='"+i+"'>"+where[i].loca+"</option>";
}
provincediv.innerHTML="<SELECT size=1 onchange='city()' name=MainMenu>"+str.join() + "</SELECT>";
}

function city(){
a=document.all.MainMenu.options[document.all.MainMenu.selectedIndex].value

str1=where[a].locacity;
s=str1.split("|");
str = new Array();
for ( i=0;i<s.length-1;i++ )
{str[i] = "<option>"+s[i]+"</option>";
}
citydiv.innerHTML="<SELECT size=1 onchange='city()' name=subMenu>"+str.join() + "</SELECT>";
}
//-->>


</SCRIPT>
</script>
</HEAD>

<BODY onload="province()">
<td><div id="provincediv"></div><div id="citydiv"></div></td>



</BODY>
</HTML>
回复
ycted 2004-08-11
http://fason.nease.net/download/
回复
ycted 2004-08-11
你可以去http://fason.nease.net/去找.里面有你需要的
回复
加载更多回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-11 10:37
社区公告
暂无公告