日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[转贴]无刷新的2个DropDownList联动

發布時間:2025/4/16 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [转贴]无刷新的2个DropDownList联动 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
????<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()?
{??
???
//?var?obj=document.getElementById("Lable1");
???//?obj.Text="dssd";
????//document.all.
???//?obj.Text=province.options[province.selectedIndex].value;
????with(document.all.Form1.province)?
????{?
????????
var?loca2?=?options[selectedIndex].value;?
????????document.all.HiddenValue.value?
=?loca2;
????}
????
for(i?=?0;i?<?where.length;i++)?
????{
????????
if?(where[i].loca?==?loca2)?
????????????{
????????????loca3?
=?(where[i].locacity).split("|");
????????????????
for(j?=?1;j?<?loca3.length;j++)?
????????????????{?
????????????????????
with(document.all.Form1.city)?
????????????????????????{?
????????????????????????????length?
=?loca3.length;?
????????????????????????????options[j].text?
=?loca3[j];?
????????????????????????????options[j].value?
=?loca3[j];
????????????????????????????
????????????????????????}
????????????????}
????????????
break;
????????????}
????????}
????????
with(document.all.Form1.city)?
????????{?
????????????options[
0].selected?=?true;
????????}
????
//document.creator.address.value=loca2+loca4;
}
function?select1()?{
????
with(document.all.Form1.city)?
????{
????????
var?loca4=options[selectedIndex].value;
????????document.all.HiddenValueshi.value?
=?loca4;
????}
}

function?init()?{
?????
var?cprin;
?????
????
with(document.all.Form1.province)?
????{
????????length?
=?where.length;
????????
for(k=0;k<where.length;k++)?
????????{??
????????????options[k].text?
=?where[k].loca;?
????????????options[k].value?
=?where[k].loca;?
????????????
if?(where[k].loca==document.all.HiddenValue.value)
?????????????cprin
=where[k].locacity;
????????}
????
????????
????????
if?(document.all.HiddenValue.value=="")
??????????{options[selectedIndex].text?
=?where[0].loca;
???????????options[selectedIndex].value?
=?where[0].loca;
??????????}
????????
else
????????{
??????????options[selectedIndex].text
=document.all.HiddenValue.value;
??????????options[selectedIndex].value
=document.all.HiddenValue.value;
????????}?
????}
????
with(document.all.Form1.city)?
????{
????????
????????
if?(document.all.HiddenValueshi.value=="")
????????{
????????????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?
=?where[0].loca;?options[selectedIndex].value?=?where[0].loca;
?????????}
?????????
else
?????????{
?????????
???????????loca3?
=?cprin.split("|");
????????????length?
=?loca3.length;
????????????
for(l=0;l<length;l++)?
????????????{?
????????????????options[l].text?
=?loca3[l];?options[l].value?=?loca3[l];?
????????????}
???????????options[selectedIndex].text
=document.all.HiddenValueshi.value;
???????????options[selectedIndex].value
=document.all.HiddenValueshi.value;
?????????}?
???????????
????}
}
?
-->
????????
</script>

<body?MS_POSITIONING="GridLayout"?onload="init();">
????????
<form?id="Form1"?method="post"?runat="server">
????????????
<asp:dropdownlist?id="province"?Runat="server"></asp:dropdownlist><asp:dropdownlist?id="city"?Runat="server"></asp:dropdownlist></SELECT><asp:button?id="Button1"?style="Z-INDEX:?101;?LEFT:?240px;?POSITION:?absolute;?TOP:?48px"?runat="server"
????????????????Text
="Button"></asp:button><asp:label?id="Label1"?style="Z-INDEX:?102;?LEFT:?280px;?POSITION:?absolute;?TOP:?136px"?runat="server">Label</asp:label><input?id="HiddenValue"?type="hidden"?name="HiddenValue"?runat="server">
????????????
<input?id="HiddenValueshi"?type="hidden"?name="HiddenValueshi"?runat="server">
????
</form>
????
</body>
?Private?Sub?Page_Load()Sub?Page_Load(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?MyBase.Load
????????
'If?Not?Page.IsStartupScriptRegistered("init")?Then
????????'?Page.RegisterStartupScript("init",?"<script>init();</script>")
????????'End?If

????????
If?Not?IsPostBack?Then

????????????province.Attributes.Add(
"onchange",?"select()")
????????????city.Attributes.Add(
"onchange",?"select1()")

????????
End?If

????
End?Sub


????
Private?Sub?Button1_Click()Sub?Button1_Click(ByVal?sender?As?Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click
????????Response.
Write(HiddenValue.Value)
????????Response.
Write(HiddenValueshi.Value)

????
End?Sub

總結

以上是生活随笔為你收集整理的[转贴]无刷新的2个DropDownList联动的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。