| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 496 人关注过本帖
标题:各位大哥求救了!!!!!!!!!!!!
只看楼主 加入收藏
guorui
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-10
收藏
 问题点数:0 回复次数:6 
各位大哥求救了!!!!!!!!!!!!

我的意图是一个页面两个下拉框 ,第一个为文件发送部门名趁,第二个为文件类型,目的:当用户选择不同部门时,后面的文件类型自动检索数据库,构成相应的下拉选项,部门名趁与文件类型已在数据库内匹配好了。

[此贴子已经被作者于2005-12-10 11:53:55编辑过]

搜索更多相关主题的帖子: 数据库 大哥 用户 
2005-12-10 11:53
guorui
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-10
收藏
得分:0 

斑竹帮帮忙急用

2005-12-10 15:03
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 
不大明白你的意思

中国人的财富网:http://www..cn/
2005-12-10 15:41
guorui
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-10
收藏
得分:0 

你好我的意思是这样的比如说注册的时候 省份你一旦选择四川。则后面的城市选项就全部是四川的。就是 后一个下拉与前一个下拉相联系。根据前一个检索

2005-12-10 15:51
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>关联选择</title>
</head>

<body>

<p></p>
<form name="form1">
<select onchange="SelectCity()" name="selProvince">
<script language="javascript">
var str=''
str ="<option selected value=>-省/直辖市-</option>"
str+="<option value=00>北京</option>"
str+="<option value=01>天津</option>"
str+="<option value=02>河北省</option>"
str+="<option value=03>山西省</option>"
str+="<option value=04>内蒙古</option>"
str+="<option value=05>辽宁省</option>"
str+="<option value=06>吉林省</option>"
str+="<option value=07>黑龙江省</option>"
str+="<option value=08>上海</option>"
str+="<option value=09>江苏省</option>"
str+="<option value=10>浙江省</option>"
str+="<option value=11>安徽省</option>"
str+="<option value=12>福建省</option>"
str+="<option value=13>江西省</option>"
str+="<option value=14>山东省</option>"
str+="<option value=15>河南省</option>"
str+="<option value=16>湖北省</option>"
str+="<option value=17>湖南省</option>"
str+="<option value=18>广东省</option>"
str+="<option value=19>广西省</option>"
str+="<option value=20>海南省</option>"
str+="<option value=21>重庆</option>"
str+="<option value=22>四川省</option>"
str+="<option value=23>贵州省</option>"
str+="<option value=24>云南省</option>"
str+="<option value=25>西藏</option>"
str+="<option value=26>陕西省</option>"
str+="<option value=27>甘萧省</option>"
str+="<option value=28>青海省</option>"
str+="<option value=29>宁夏省</option>"
str+="<option value=30>新疆</option>"
str+="<option value=31>香港</option>"
str+="<option value=32>澳门</option>"
str+="<option value=33>台湾</option>"
document.write(str)
</script>
</select> <select name="city">
<option value selected>-地区/城市-</option>
</select>
<select name="city1">
<option value selected>-地区/城市-</option>
</select>
</form>
<script language="javascript">
var thecity = new Array("0000北京市","0100天津市","0200 秦皇岛市","0201沧州市","0202廊坊市","0203衡水市","0204石家庄市",
"0205邯郸市","0206邢台市","0207保定市","0208张家口市","0209承德市","0210唐山市","0300太原市","0301大同市",
"0302阳泉市","0303长治市","0304晋城市","0305朔州市","0306忻州地区","0307晋中地区","0308吕梁地区",
"0309临汾地区","0310运城地区","0400呼和浩特市","0401包头市","0402乌海市","0403赤峰市","0404乌兰察布盟",
"0405锡林郭勒盟","0406呼伦贝尔盟","0407哲里木盟","0408巴彦淖尔盟","0409伊克昭盟","0410阿拉善盟",
"0411兴安盟","0500沈阳市","0501大连市","0502鞍山市","0503抚顺市","0504本溪市","0505丹东市","0506锦州市",
"0507葫芦岛市","0508营口市","0509盘锦市","0510阜新市","0511辽阳市","0512铁岭市","0513朝阳市","0600长春市",
"0601吉林市","0602四平市","0603辽源市","0604通化市","0605白山市","0606松原市","0607白城市","0608延边自治州",
"0700哈尔滨市","0701齐齐哈尔市","0702鹤岗市","0703双鸭山市","0704鸡西市","0705大庆市","0706伊春市",
"0707牡丹江市","0708佳木斯市","0709七台河市","0710黑河市","0711绥化地区","0712大兴安岭地区","0800上海市",
"0900南京市","0901徐州市","0902连云港市","0903淮阴市","0904宿迁市","0905盐城市","0906扬州市","0907泰州市",
"0908南通市","0909镇江市","0910常州市","0911无锡市","0912苏州市","1000杭州市","1001宁波市","1002温州市",
"1003嘉兴市","1004湖州市","1005绍兴市","1006金华市","1007衢州市","1008舟山市","1009台州市","1010丽水地区",
"1100淮北市","1101芜湖市","1102铜陵市","1103蚌埠市","1104马鞍山市","1105安庆市","1106黄山市","1107滁州市",
"1108阜阳市","1109宿州市","1110安徽省直辖市","1111巢湖地区","1112宣城地区","1113池州地区","1114六安地区",
"1115合肥市","1116淮南市","1200福州市","1201厦门市","1202三明市","1203莆田市","1204泉州市","1205漳州市",
"1206南平市","1207龙岩市","1208宁德地区","1300南昌市","1301景德镇市","1302萍乡市","1303新余市","1304九江市",
"1305鹰谭市","1306赣州市","1307上饶地区","1308宜春地区","1309抚州地区","1310吉安地区","1400济南市",
"1401青岛市","1402淄博市","1403枣庄市","1404东营市","1405潍坊市","1406烟台市","1407威海市","1408济宁市",
"1409泰安市","1410日照市","1411莱芜市","1412德州市","1413临沂市","1414聊城市","1415滨州地区","1416菏泽地区",
"1500郑州市","1501开封市","1502洛阳市","1503平顶山市","1504焦作市","1505鹤壁市","1506新乡市","1507安阳市",
"1508濮阳市","1509许昌市","1510漯河市","1511山门峡市","1512南阳市","1513商丘市","1514信阳市",
"1515河南省直辖区","1516周口地区","1517驻马店地区","1600武汉市","1601黄石市","1602襄樊市","1603十堰市",
"1604荆州市","1605宜昌市","1606鄂州市","1607孝感市","1608黄冈市","1609咸宁市","1610湖北省直辖区",
"1611荆门市","1612恩施自治州","1700长沙市","1701株洲市","1702湘潭市","1703衡阳市","1704邵阳市",
"1705岳阳市","1706常德市","1707张家界市","1708湘西自治州","1709郴州市","1710益阳市","1711永州市","1712怀化市",
"1713娄底地区","1800广州市","1801深圳市","1802珠海市","1803汕头市","1804韶关市","1805河源市","1806梅州市",
"1807惠州市","1808汕尾市","1809东莞市","1810中山市","1811江门市","1812佛山市","1813阳江市","1814湛江市",
"1815茂名市","1816肇庆市","1817云浮市","1818清远市","1819潮州市","1820揭阳市","1900南宁市","1901柳州市",
"1902桂州市","1903梧州市","1904北海市","1905防城港市","1906钦州市","1907贵港市","1908玉林市","1909南宁地区",
"1910柳州地区","1911贺州地区","1912百色地区","1913河池地区","2000海口市","2001三亚市","2002文昌市",
"2003儋州市","2004琼海市","2005东方市","2006海南省直辖区","2100重庆市","2200成都市","2201自贡市",
"2202攀枝花市","2203泸州市","2204德阳市","2205广元市","2206遂宁市","2207内江市","2208乐山市","2209南充市",
"2210绵阳市","2211宜宾市","2212广安市","2213达川市","2214巴中地区","2215雅安地区","2216眉山地区",
"2217资阳地区","2218阿坝自治洲","2219甘孜自治州","2220凉山自治州","2300贵阳市","2301六盘水市","2302遵义市",
"2303侗仁地区","2304毕节地区","2305安顺地区","2306黔西南自治州","2307黔东南自治州","2308黔南自治州",
"2400昆明市","2401曲靖市","2402玉溪市","2403昭通地区","2404思茅地区","2405临沧地区","2406保山地区",
"2407丽江地区","2408文山自治州","2409红河自治州","2410西双版纳自治州","2411楚雄自治州","2412大理自治州",
"2413德宏自治州","2414怒江自治州","2415迪庆自治州","2500拉萨市","2501那曲地区","2502昌都地区","2503山南地区",
"2504日喀则地区","2505阿里地区","2506林芝地区","2600西安市","2601铜川市","2602宝鸡市","2603咸阳市",
"2604渭南市","2605延安市","2606汉中市","2607榆林地区","2608商洛地区","2609安康地区","2700兰州市",
"2701金昌市","2702白银市","2703天水市","2704嘉峪关市","2705定西地区","2706平凉地区","2707庆阳地区",
"2708陇南地区","2709武威地区","2710张掖地区","2711酒泉地区","2712甘南自治州","2713临夏自治州","2800西宁市",
"2801海东地区","2802海北自治州","2803黄南自治州","2804海南自治州","2805果洛自治州","2806玉树自治州",
"2807海西自治州","2900银川市","2901石嘴山市","2902吴忠市","2903固原地区","3000乌鲁木齐市","3001克拉玛依市",
"3002省直辖区","3003吐鲁番地区","3004哈密地区","3005和田地区","3006阿克苏依地区","3007喀什地区",
"3008克孜勒苏自治州","3009巴音郭楞自治州","3010昌吉自治州","3011博尔塔拉自治州","3012伊犁自治州",
"3013伊犁地区","3014塔城地区","3015阿勒泰地区","3100香港","3200澳门","3300台湾",
"0913常熟市","0514锦西市","0713松花江地区","3016石河子市","1821顺德市","1914桂林地区",
"1915桂林市","1916梧州地区","2416东川市","1714零陵地区")

function SelectCity(){
var i=0;
for(i=0;i<form1.selProvince.length;i++){
if(form1.selProvince[i].selected==true){
var tempstr = form1.selProvince[i].value;
break;
}
}

if(tempstr!=""){
form1.city.length=0;
form1.city1.length=0;
var oOption = document.createElement('OPTION');
var oOption1 = document.createElement('OPTION');
oOption.text = "-地区/城市-";
oOption1.text = "-地区/城市-";
oOption.value = "";
oOption1.value = "";
form1.city.options.add(oOption);
form1.city1.options.add(oOption1);
for(i=0;i<thecity.length;i++){
if(thecity[i].substring(0,2)==tempstr){
//alert(city[i].substring(0,2));
var oOption = document.createElement('OPTION');
var oOption1 = document.createElement('OPTION');
oOption.text=thecity[i].substring(4);
oOption1.text=thecity[i].substring(4);
oOption.value=thecity[i].substring(0,4);
oOption1.value=thecity[i].substring(0,4);
//alert(oOption.text);
//alert(oOption.value);
form1.city.options.add(oOption);
form1.city1.options.add(oOption1);
}
}
}
else
form1.city[0].selected=true;
form1.city1[0].selected=true;
return true;
};
</script>

[此贴子已经被作者于2005-12-10 15:57:34编辑过]


中国人的财富网:http://www..cn/
2005-12-10 15:57
guorui
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-10
收藏
得分:0 
多谢
2005-12-10 15:58
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

其实二级联动的下拉列表,并不是在列表选择时读取数据库。而是把数据库的所有数据都读出来,列表选择时用JavaScript来选择读取第二个下拉列表。

2005-12-10 17:10
快速回复:各位大哥求救了!!!!!!!!!!!!
数据加载中...
 
   



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

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