成都网站建设设计

将想法与焦点和您一起共享

太原javascript,太原工业学院

关于javascript中select下拉列表的一些用法

这个非常麻烦,给你一个三级的例子,自己看吧,你不给我分都可以,只是想用你一下:

惠民网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设等网站项目制作,到程序开发,运营维护。创新互联于2013年成立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联

html

head

title网页特效|xrss.cn/Js|--- 三级下拉菜单 (通用版)/title

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

/head

body

SCRIPT LANGUAGE="JavaScript"

!--

function CreateSelect(_FormName,_SName,_SValue,_Ds,_AllOptionStr,ShowType)

{

//三级关链菜单通用版

//作者:海娃, 有问题请到留言。

if (_FormName=="")

_FormName = "all"

var _DsArr = _Ds.split("|")

var _Ds1,_Ds2,_Ds3

var _Ds1 = _DsArr[0]

var _Ds2 = (_DsArr.length1)?_DsArr[1]:_DsArr[0]

var _Ds3 = (_DsArr.length2)?_DsArr[2]:_DsArr[0]

var _SNameArr = _SName.split("|")

var _SName1,_SName2,_SName3

var _SName1 = _SNameArr[0]

var _SName2 = (_SNameArr.length1)?_SNameArr[1]:_SNameArr[0]

var _SName3 = (_SNameArr.length2)?_SNameArr[2]:_SNameArr[0]

var _SValueArr = _SValue.split("|")

var _SValue1,_SValue2,_SValue3

var _SValue1 = _SValueArr[0]

var _SValue2 = (_SValueArr.length1)?_SValueArr[1]:_SValueArr[0]

var _SValue3 = (_SValueArr.length2)?_SValueArr[2]:_SValueArr[0]

if (ShowType==3){

_AllOptionStr = _AllOptionStr.replace(/\(\(/ig,"\(\("+_Ds3+"\^")

_AllOptionStr = _AllOptionStr.replace(/\{\{/ig,"\{\{"+_Ds2+"\(\("+_Ds3+"\*\*")

}

else if(ShowType==2){

_AllOptionStr = _AllOptionStr.replace(/\{\{/ig,"\{\{"+_Ds2+"\(\("+_Ds3+"\*\*")

}

else if(ShowType==1){

_AllOptionStr = _AllOptionStr.replace(/\(\(/ig,"\(\("+_Ds3+"\^")

}

var AllStr = _Ds1 + "{{"+ _Ds2 + "(("+ _Ds3 +"||"+_AllOptionStr

//alert(AllStr)

var _AR0 = AllStr.split("||");

document.writeln("select name=\"" + _SName1 + "\" size=\"1\" onChange=\""+_SName1+"redirect(this.options.selectedIndex)\"");

for (var i1 = 0;i1 _AR0.length;i1++)

{

var Area1Str = _AR0[i1];

var _AR10 = Area1Str.split("{{");

var _AR11 = _AR10[0].split("@");

var Tstr1 = _AR11[0];

var Vstr1 = (_AR11.length==2)?_AR11[1]:_AR11[0]

document.writeln("option value=\""+Vstr1+"\""+Tstr1+"\/option");

}

document.writeln("\/select");

document.writeln("select name=\"" + _SName2 + "\" size=\"1\" onChange=\""+_SName1+"redirect1(this.options.selectedIndex)\"");

var _AR111 = _Ds2.split("@");

var Tstr11 = _AR111[0];

var Vstr11 = (_AR111.length==2)?_AR111[1]:_AR111[0];

document.writeln("option value=\""+Vstr11+"\""+Tstr11+"\/option");

document.writeln("\/select");

document.writeln("select name=\"" + _SName3 + "\" size=\"1\"");

var _AR222 = _Ds3.split("@");

var Tstr22 = _AR222[0];

var Vstr22 = (_AR222.length==2)?_AR222[1]:_AR222[0];

document.writeln("option value=\""+Vstr22+"\""+Tstr22+"\/option");

document.writeln("\/select");

document.writeln("S"+"CRIPT LANGUAGE=\"JavaScript\" defer");

document.writeln("!--");

document.writeln("var "+_SName1+"NewAllStr = \""+ AllStr +"\"");

document.writeln("var "+_SName1+"_AR0 = "+_SName1+"NewAllStr.split(\"||\");");

document.writeln("var "+_SName1+"groups=document."+ _FormName +"." + _SName1 + ".options.length;");

document.writeln("var "+_SName1+"group=new Array("+_SName1+"groups)");

document.writeln("for (i=0; i"+_SName1+"groups; i++){");

document.writeln(" "+_SName1+"group[i]=new Array();");

document.writeln("}");

document.writeln("for (var i1 = 0;i1 "+_SName1+"_AR0.length;i1++){");

document.writeln(" var Area1Str = "+_SName1+"_AR0[i1];");

document.writeln(" var _AR10 = Area1Str.split(\"{{\");");

document.writeln(" var _AR12 = _AR10[1].split(\"**\");");

document.writeln(" for (var i2 = 0;i2 _AR12.length;i2++){");

document.writeln(" var Area2Str = _AR12[i2];");

document.writeln(" var _AR20 = Area2Str.split(\"((\");");

document.writeln(" var _AR211 = _AR20[0].split(\"@\");");

document.writeln(" var Tstr2 = _AR211[0];");

document.writeln(" var Vstr2 = (_AR211.length==2)?_AR211[1]:_AR211[0];");

document.writeln(" "+_SName1+"group[i1][i2]=new Option(Tstr2,Vstr2);");

document.writeln(" }");

document.writeln("}");

document.writeln("var "+_SName1+"temp = document."+ _FormName +"." + _SName2);

document.writeln("function "+_SName1+"redirect(x){");

document.writeln(" for (m="+_SName1+"temp.options.length-1;m0;m--)");

document.writeln(" "+_SName1+"temp.options[m]=null;");

document.writeln(" for (i=0;i"+_SName1+"group[x].length;i++){");

document.writeln(" "+_SName1+"temp.options[i]=new Option("+_SName1+"group[x][i].text,"+_SName1+"group[x][i].value);");

document.writeln(" }");

document.writeln(" "+_SName1+"temp.options[0].selected=true");

document.writeln(" "+_SName1+"redirect1(0)");

document.writeln("}");

document.writeln("var "+_SName1+"Group2s=document."+ _FormName +"." + _SName2 + ".options.length;");

document.writeln("var "+_SName1+"Group2=new Array("+_SName1+"groups);");

document.writeln("for (i=0; i"+_SName1+"groups; i++){");

document.writeln(" "+_SName1+"Group2[i]=new Array("+_SName1+"group[i].length)");

document.writeln(" for (j=0; j"+_SName1+"group[i].length; j++){");

document.writeln(" "+_SName1+"Group2[i][j]=new Array()");

document.writeln(" }");

document.writeln("}");

document.writeln("for (var i1 = 0;i1 "+_SName1+"_AR0.length;i1++){");

document.writeln(" var Area1Str = "+_SName1+"_AR0[i1]");

document.writeln(" var _AR10 = Area1Str.split(\"{{\");");

document.writeln(" var _AR12 = _AR10[1].split(\"**\");");

document.writeln(" for (var i2 = 0;i2 _AR12.length;i2++){");

document.writeln(" var Area2Str = _AR12[i2]");

document.writeln(" var _AR20 = Area2Str.split(\"((\");");

document.writeln(" _AR212 = _AR20[1].split(\"^\");");

document.writeln(" for (var i3 = 0;i3 _AR212.length;i3++){");

document.writeln(" Area3Str = _AR212[i3]");

document.writeln(" _AR3 = Area3Str.split(\"@\");");

document.writeln(" Tstr3 = _AR3[0]");

document.writeln(" Vstr3 = (_AR3.length==2)?_AR3[1]:_AR3[0]");

document.writeln(" "+_SName1+"Group2[i1][i2][i3]=new Option(Tstr3,Vstr3);");

document.writeln(" }");

document.writeln(" }");

document.writeln("}");

document.writeln("var "+_SName1+"temp1=document."+ _FormName +"." + _SName3 + "");

document.writeln("function "+_SName1+"redirect1(y){");

document.writeln(" for (m="+_SName1+"temp1.options.length-1;m0;m--)");

document.writeln(" "+_SName1+"temp1.options[m]=null");

document.writeln(" for (i=0;i"+_SName1+"Group2[document."+ _FormName +"." + _SName1 + ".options.selectedIndex][y].length;i++){");

document.writeln(" "+_SName1+"temp1.options[i]=new Option("+_SName1+"Group2[document."+ _FormName +"." + _SName1 + ".options.selectedIndex][y][i].text," + _SName1 + "Group2[document."+ _FormName +"." + _SName1 + ".options.selectedIndex][y][i].value)");

document.writeln(" }");

document.writeln(" "+_SName1+"temp1.options[0].selected=true");

document.writeln("}");

document.writeln("\/\/--");

document.writeln("\/script");

document.writeln("s"+"cript language=\"JavaScript\"");

document.writeln("!--");

document.writeln("function "+_SName1+"SetValue(){");

document.writeln(" try{");

document.writeln(" if (\""+_SValue1+"\"!=\"\"){");

document.writeln(" document."+ _FormName +"."+_SName1+".value=\""+_SValue1+"\"");

document.writeln(" "+_SName1+"redirect(document."+ _FormName +"."+_SName1+".options.selectedIndex);");

document.writeln(" if (\""+_SValue2+"\"!=\"\"){");

document.writeln(" document."+ _FormName +"."+_SName2+".value=\""+_SValue2+"\"");

document.writeln(" "+_SName1+"redirect1(document."+ _FormName +"."+_SName2+".options.selectedIndex)");

document.writeln(" if (\""+_SValue3+"\"!=\"\")");

document.writeln(" document."+ _FormName +"."+_SName3+".value=\""+_SValue3+"\"");

document.writeln(" }");

document.writeln(" }");

document.writeln(" }");

document.writeln(" catch(e){");

document.writeln(" }");

document.writeln("}");

document.writeln("window.attachEvent(\"onload\","+_SName1+"SetValue)");

document.writeln("\/\/--");

document.writeln("\/script");

}

//--

/script

SCRIPT LANGUAGE="JavaScript"

!--

var AllStr1 = ""

+"东北地区{{"

+"黑龙江((哈尔滨^齐齐哈尔^牡丹江^佳木斯^大庆^绥化^鹤岗^鸡西^黑河^双鸭山^伊春^七台河^大兴安岭"

+"**吉林((长春^吉林^四平^辽源^通化^白山^松原^白城^延边"

+"**辽宁((沈阳^大连^鞍山^抚顺^本溪^丹东^锦州^营口^阜新^辽阳^盘锦^铁岭^朝阳^葫芦岛"

+"||华北地区{{"

+"北京((东城^西城^崇文^宣武^朝阳^丰台^石景山^海淀^门头沟^房山^通州^顺义^昌平^大兴^平谷^怀柔^密云^延庆"

+"**天津((和平^东丽^河东^西青^河西^津南^南开^北辰^河北^武清^红挢^塘沽^汉沽^大港^宁河^静海^宝坻^蓟县"

+"**山东((济南^青岛^淄博^枣庄^东营^烟台^潍坊^济宁^泰安^威海^日照^莱芜^临沂^德州^聊城^滨州^菏泽"

+"**河北((石家庄^邯郸^邢台^保定^张家口^承德^廊坊^唐山^秦皇岛^沧州^衡水"

+"**河南((郑州^开封^洛阳^平顶山^安阳^鹤壁^新乡^焦作^濮阳^许昌^漯河^三门峡^南阳^商丘^信阳^周口^驻马店^济源"

+"**山西((太原^大同^阳泉^长治^晋城^朔州^吕梁^忻州^晋中^临汾^运城"

+"**内蒙古((呼和浩特^包头^乌海^赤峰^呼伦贝尔盟^阿拉善盟^哲里木盟^兴安盟^乌兰察布盟^锡林郭勒盟^巴彦淖尔盟^伊克昭盟"

+"||华中地区{{"

+"湖北((武汉^宜昌^荆州^襄樊^黄石^荆门^黄冈^十堰^恩施^潜江^天门^仙桃^随州^咸宁^孝感^鄂州"

+"**湖南((长沙^常德^株洲^湘潭^衡阳^岳阳^邵阳^益阳^娄底^怀化^郴州^永州^湘西^张家界"

+"||华南地区{{"

+"广东((广州^深圳^珠海^汕头^东莞^中山^佛山^韶关^江门^湛江^茂名^肇庆^惠州^梅州^汕尾^河源^阳江^清远^潮州^揭阳^云浮"

+"**广西((南宁^柳州^桂林^梧州^北海^防城港^钦州^贵港^玉林^南宁地区^柳州地区^贺州^百色^河池"

+"**福建((福州^厦门^莆田^三明^泉州^漳州^南平^龙岩^宁德"

+"**海南((海口^三亚"

+"||西南地区{{"

+"四川((成都^绵阳^德阳^自贡^攀枝花^广元^内江^乐山^南充^宜宾^广安^达川^雅安^眉山^甘孜^凉山^泸州"

+"**重庆((万州^涪陵^渝中^大渡口^江北^沙坪坝^九龙坡^南岸^北碚^万盛^双挢^渝北^巴南^黔江^长寿^綦江^潼南^铜梁^大足^荣昌^壁山^梁平^城口^丰都^垫江^武隆^忠县^开县^云阳^奉节^巫山^巫溪^石柱^秀山^酉阳^彭水^江津^合川^永川^南川"

+"**贵州((贵阳^六盘水^遵义^安顺^铜仁^黔西南^毕节^黔东南^黔南"

+"**云南((昆明^大理^曲靖^玉溪^昭通^楚雄^红河^文山^思茅^西双版纳^保山^德宏^丽江^怒江^迪庆^临沧"

+"**西藏((拉萨^日喀则^山南^林芝^昌都^阿里^那曲"

+"||西北地区{{"

+"陕西((西安^宝鸡^咸阳^铜川^渭南^延安^榆林^汉中^安康^商洛"

+"**甘肃((兰州^嘉峪关^金昌^白银^天水^酒泉^张掖^武威^定西^陇南^平凉^庆阳^临夏^甘南"

+"**宁夏((银川^石嘴山^吴忠^固原"

+"**青海((西宁^海东^海南^海北^黄南^玉树^果洛^海西"

+"**新疆((乌鲁木齐^石河子^克拉玛依^伊犁^巴音郭勒^昌吉^克孜勒苏柯尔克孜^博尔塔拉^吐鲁番^哈密^喀什^和田^阿克苏"

+"||华东地区{{"

+"上海((黄浦^卢湾^徐汇^长宁^静安^普陀^闸北^虹口^杨浦^闵行^宝山^嘉定^浦东^金山^松江^青浦^南汇^奉贤^崇明"

+"**江苏((南京^镇江^苏州^南通^扬州^盐城^徐州^连云港^常州^无锡^宿迁^泰州^淮安"

+"**浙江((杭州^宁波^温州^嘉兴^湖州^绍兴^金华^衢州^舟山^台州^丽水"

+"**安徽((合肥^芜湖^蚌埠^马鞍山^淮北^铜陵^安庆^黄山^滁州^宿州^池州^淮南^巢湖^阜阳^六安^宣城^亳州"

+"**江西((南昌市^景德镇^九江^鹰潭^萍乡^新馀^赣州^吉安^宜春^抚州^上饶"

+"||港澳台地区{{"

+"香港((香港"

+"**澳门((澳门"

+"**台湾((台北^高雄^台中^台南^屏东^南投^云林^新竹^彰化^苗栗^嘉义^花莲^桃园^宜兰^基隆^台东^金门^马祖^澎湖"

+"||其它地区{{"

+"其它((其它"

//--

/SCRIPT

FORM name="HwForm"

HR选择一次br

SCRIPT LANGUAGE="JavaScript"

CreateSelect("","S_13|S_23|S_33","","请选择地区@|请选择省份@|请选择城市@",AllStr1,0);

/SCRIPT

HR选择三次br

SCRIPT LANGUAGE="JavaScript"

CreateSelect("HwForm","S_1|S_2|S_3","华北地区|山东|济宁","请选择地区@|请选择省份@|请选择城市@",AllStr1,3);

/SCRIPT

SCRIPT LANGUAGE="JavaScript"

!--

var AllStr2 = ""

+"笔记本{{"

+"IBM((R32^T40^T42"

+"**DELL((N600^M600"

+"||数码相机{{"

+"CANON((A75^A80^A85"

+"**SONY((S80^S60"

//--

/SCRIPT

HR选择二次brSCRIPT LANGUAGE="JavaScript"

CreateSelect("HwForm","S_11|S_21|S_31","笔记本|IBM|T42","请选择分类@|请选择品牌@|请选择系列@",AllStr2,2);

/SCRIPT

HR选择二次brSCRIPT LANGUAGE="JavaScript"

CreateSelect("HwForm","S_12|S_22|S_32","","请选择分类@|请选择品牌@|请选择系列@",AllStr2,1);

/SCRIPT

/FORM

/body

/html

JS提示 Cannot read property '0' of undefined

for (var i in cities)改为:for (var i=0;icities.length;i++ )。

for(var i=0;i=bullets.length;i++){

this.ctx.drawImage(bullet,bullets[i][0]+55,bullets[i][1]); 这里报错

}变为

for(var i=0;ibullets.length;i++){

this.ctx.drawImage(bullet,bullets[i][0]+55,bullets[i][1]); 这里报错

}

扩展资料:

Javascript被归类为直译语言,因为主流的引擎都是每次运行时加载代码并解译。V8是将所有代码解译后再开始运行,其他引擎则是逐行解译(SpiderMonkey会将解译过的指令暂存,以提高性能,称为实时编译),但由于V8的核心部分多数用Javascript撰写(而SpiderMonkey是用C++),因此在不同的测试上,两者性能互有优劣。

与其相对应的是编译语言,例如C语言,以编译语言编写的程序在运行之前,必须经过编译,将代码编译为机器码,再加以运行。

参考资料来源:百度百科-javascript

太原的少儿编程的机构有推荐吗?

太原少儿编程机构推荐选择童程童美,该机构通过趣味化的编程项目,培养孩子综合竞争能力。用编程对话未来,做AI时代的创造者。童程童美少儿编程体验课,点击可免费报名试听

童程童美以故事情节代入学习项目,让孩子迅速进入到编程学习状态。学生在云端操作即可运行结果,老师与学生共享桌面,实时查看学习情况。寓教于乐,通过游戏的方式,让孩子边玩边学。通过趣味编程教育激发孩子的编程潜能,为未来编程职业发展提供更好的机会与方向。作为线上线下一体的少儿编程科技教育平台,线上课程汲取百所校区面授成果,学习检验成功有效。学习平台覆盖全国。满足孩子就近学习,更高效,更便捷。学少儿编程可以提高孩子逻辑思维、专注力!

想了解更多关于少儿编程的相关内容,推荐咨询童程童美。童程童美是由童程童美独立开发的专有可视化在线少儿编程教育平台,针对6—18岁青少儿提供线上小班直播授课。课程覆盖Scratch图形界面编程、Python人工智能编程、NOI系列课程三大课程体系。依托故事化、可视化、游戏化的学习方式,采用自主研发的云平台编程环境,让学生在云端操作即可运行出结果。

省份必填 js 校验

SCRIPT LANGUAGE="JavaScript"

!-- ###中国省市二级联动菜单开始##如有问题请到 QQ 347993010 hulei0217@126.com找我!##

function Dsy()

{

this.Items = {};

}

Dsy.prototype.add = function(id,iArray)

{

this.Items[id] = iArray;

}

Dsy.prototype.Exists = function(id)

{

if(typeof(this.Items[id]) == "undefined") return false;

return true;

}

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]).selectedIndex0 || !v)

{

if(dsy.Exists(str)){

ar = dsy.Items[str];

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);}

}

}

var dsy = new Dsy();

dsy.add("0",["北京市","天津市","河北省","山西省","内蒙古","辽宁省","吉林省","黑龙江省","上海市","江苏省","浙江省","安徽省","福建省","江西省","山东省","河南省","湖北省","湖南省","广东省","广西自治区","海南省","重庆市","四川省","贵州省","云南省","西藏自治区","陕西省","甘肃省","青海省","宁夏回族自治区","新疆维吾尔自治区","香港特别行政区","澳门特别行政区","台湾省","其它"]);

dsy.add("0_0",["北京","东城区","西城区","崇文区","宣武区","朝阳区","丰台区","石景山区"," 海淀区(中关村)","门头沟区","房山区","通州区","顺义区","昌平区","大兴区","怀柔区","平谷区","密云县","延庆县","其他"]);

dsy.add("0_1",["和平区","河东区","河西区","南开区","红桥区","塘沽区","汉沽区","大港区","西青区","津南区","武清区","蓟县","宁河县","静海县","其他"]);

dsy.add("0_2",["石家庄市","张家口市","承德市","秦皇岛市","唐山市","廊坊市","衡水市","沧州市","邢台市","邯郸市","保定市","其他"]);

dsy.add("0_3",["太原市","朔州市","大同市","长治市","晋城市","忻州市","晋中市","临汾市","吕梁市","运城市","其他"]);

dsy.add("0_4",["呼和浩特市","包头市","赤峰市","呼伦贝尔市","鄂尔多斯市","乌兰察布市","巴彦淖尔市","兴安盟","阿拉善盟","锡林郭勒盟","其他"]);

dsy.add("0_5",["沈阳市","朝阳市","阜新市","铁岭市","抚顺市","丹东市","本溪市","辽阳市","鞍山市","大连市","营口市","盘锦市","锦州市","葫芦岛市","其他"]);

dsy.add("0_6",["长春市","白城市","吉林市","四平市","辽源市","通化市","白山市","延边朝鲜族自治州","其他"]);

dsy.add("0_7",["哈尔滨市","七台河市","黑河市","大庆市","齐齐哈尔市","伊春市","佳木斯市","双鸭山市","鸡西市","大兴安岭地区(加格达奇)","牡丹江","鹤岗市","绥化市 ","其他"]);

dsy.add("0_8",["黄浦区","卢湾区","徐汇区","长宁区","静安区","普陀区","闸北区","虹口区","杨浦区","闵行区","宝山区","嘉定区","浦东新区","金山区","松江区","青浦区","南汇区","奉贤区","崇明县","其他"]);

dsy.add("0_9",["南京市","徐州市","连云港市","宿迁市","淮安市","盐城市","扬州市","泰州市","南通市","镇江市","常州市","无锡市","苏州市","其他"]);

dsy.add("0_10",["杭州市","湖州市","嘉兴市","舟山市","宁波市","绍兴市","衢州市","金华市","台州市","温州市","丽水市","其他"]);

dsy.add("0_11",["合肥市","宿州市","淮北市","亳州市","阜阳市","蚌埠市","淮南市","滁州市","马鞍山市","芜湖市","铜陵市","安庆市","黄山市","六安市","巢湖市","池州市","宣城市","其他"]);

dsy.add("0_12",["福州市","南平市","莆田市","三明市","泉州市","厦门市","漳州市","龙岩市","宁德市","其他"]);

dsy.add("0_13",["南昌市","九江市","景德镇市","鹰潭市","新余市","萍乡市","赣州市","上饶市","抚州市","宜春市","吉安市","其他"]);

dsy.add("0_14",["济南市","聊城市","德州市","东营市","淄博市","潍坊市","烟台市","威海市","青岛市","日照市","临沂市","枣庄市","济宁市","泰安市","莱芜市","滨州市","菏泽市","其他"]);

dsy.add("0_15",["郑州市","三门峡市","洛阳市","焦作市","新乡市","鹤壁市","安阳市","濮阳市","开封市","商丘市","许昌市","漯河市","平顶山市","南阳市","信阳市","周口市","驻马店市","其他"]);

dsy.add("0_16",["武汉市","十堰市","襄樊市","荆门市","孝感市","黄冈市","鄂州市","黄石市","咸宁市","荆州市","宜昌市","随州市","恩施土家族苗族自治州","仙桃市","天门市","潜江市","神农架林区","其他"]);

dsy.add("0_17",["长沙市","张家界市","常德市","益阳市","岳阳市","株洲市","湘潭市","衡阳市","郴州市","永州市","邵阳市","怀化市","娄底市","湘西土家族苗族自治州","其他"]);

dsy.add("0_18",["广州市","清远市市","韶关市","河源市","梅州市","潮州市","汕头市","揭阳市","汕尾市","惠州市","东莞市","深圳市","珠海市","中山市","江门市","佛山市","肇庆市","云浮市","阳江市","茂名市","湛江市","其他"]);

dsy.add("0_19",["南宁市","桂林市","柳州市","梧州市","贵港市","玉林市","钦州市","北海市","防城港市","崇左市","百色市","河池市","来宾市","贺州市","其他"]);

dsy.add("0_20",["海口市","三亚市","其他"]);

dsy.add("0_21",["渝中区","大渡口区","江北区","沙坪坝区","九龙坡区","南岸区","北碚区","万盛区","双桥区","渝北区","巴南区","万州区","涪陵区","黔江区","长寿区","合川市","永川市","江津市","南川市","綦江县","潼南县","铜梁县","大足县","璧山县","垫江县","武隆县","丰都县","城口县","开县","巫溪县","巫山县","奉节县","云阳县","忠县","石柱土家族自治县","彭水苗族土家族自治县","酉阳土家族苗族自治县","秀山土家族苗族自治县","其他"]);

dsy.add("0_22",["成都市","广元市","绵阳市","德阳市","南充市","广安市","遂宁市","内江市","乐山市","自贡市","泸州市","宜宾市","攀枝花市","巴中市","资阳市","眉山市","雅安","阿坝藏族羌族自治州","甘孜藏族自治州","凉山彝族自治州县","其他"]);

dsy.add("0_23",["贵阳市","六盘水市","遵义市","安顺市","毕节地区","铜仁地区","黔东南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","其他"]);

dsy.add("0_24",["昆明市","曲靖市","玉溪市","保山市","昭通市","丽江市","普洱市","临沧市","宁德市","德宏傣族景颇族自治州","怒江僳僳族自治州","楚雄彝族自治州","红河哈尼族彝族自治州","文山壮族苗族自治州","大理白族自治州","迪庆藏族自治州","西双版纳傣族自治州","其他"]);

dsy.add("0_25",["拉萨市","那曲地区","昌都地区","林芝地区","山南地区","日喀则地区","阿里地区","其他"]);

dsy.add("0_26",["西安市","延安市","铜川市","渭南市","咸阳市","宝鸡市","汉中市","安康市","商洛市","其他"]);

dsy.add("0_27",["兰州市 ","嘉峪关市","金昌市","白银市","天水市","武威市","酒泉市","张掖市","庆阳市","平凉市","定西市","陇南市","临夏回族自治州","甘南藏族自治州","其他"]);

dsy.add("0_28",["西宁市","海东地区","海北藏族自治州","黄南藏族自治州","玉树藏族自治州","海南藏族自治州","果洛藏族自治州","海西蒙古族藏族自治州","其他"]);

dsy.add("0_29",["银川市","石嘴山市","吴忠市","固原市","中卫市","其他"]);

dsy.add("0_30",["乌鲁木齐市","克拉玛依市","喀什地区","阿克苏地区","和田地区","吐鲁番地区","哈密地区","塔城地区","阿勒泰地区","克孜勒苏柯尔克孜自治州","博尔塔拉蒙古自治州","昌吉回族自治州 伊犁哈萨克自治州","巴音郭楞蒙古自治州","河子市","阿拉尔市","五家渠市","图木舒克市","其他"]);

dsy.add("0_31",["香港","其他"]);

dsy.add("0_31",["澳门","其他"])

dsy.add("0_32",["台湾","其他"])

//--

/SCRIPT

select name="lz_sf" id="s1" option /option /select

select name="lz_sx" id="s2" option /option /select

SCRIPT language="javascript"

var s=["s1","s2"];

var opt0 = ["请选择省","请选择市"];

function setup()

{

for(i=0;i s.length-1;i++)

document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");

change(0);

}

setup()

/SCRIPT

谁知道国家选省份的javascript脚本,给个例子地址也可以。谢谢大家了!

这个是我国的各省的城市选择网页,你可以按自己的要求进行一些改动.

html

head

meta http-equiv="Content-Type" content="text/html; charset=UTF-8"

title省份选城市/title

style type="text/css"

!--

form{margin:0;padding:0;}

img{border:0;}

body,select,input,td{ font-family:宋体,Arial; font-size: 12px; font-family: Arial; margin-top: 2px;}

#hd{clear:both;width:700px;margin:0 auto;margin-bottom:.5em;padding:.5em 0 0 0;}

.rlcon a{text-decoration:none;margin-left:.3em;}

.mcon,.lpanel,.panel{text-align:left;}

.lg{float:left;width:185px;padding:.5em 0;}

.rl{float:right;width:100%;margin:0 0 0 -30em;}

.rlcon{text-align:right;height:32px;margin:0 0 0 190px;color:#b8b8b8;border-bottom:1px solid #b5b5b5;overflow:hidden;line-height:45px;}

#lcon{float:left;width:180px;}

#mcon{float:right;width:100%;margin:0 0 0 -20em;}

.mcon{margin:0 0 0 190px;width:570px;}

.xb{border-top:1px solid transparent !important;border-top:0;clear:both;}

#footer {margin:0 auto;width:740px;text-align:center;font-size:12px;height:30px;line-height:30px;border-top:1px solid #666;}

table{clear:both;text-align:left;}

#tip{clear:both;margin:0 auto;width:500px;background-color:#ffffe1;border:1px solid #ACA899;padding:1em;margin:1em;text-align:left;color:#ff0000;}

#tip #cancel{float:right;}

#tip ul{display:block;margin:0;padding:0;list-style-type:none;}

#tip ul li{float:left;width:220px;line-height:1.5em;background-color:#ffffe1;}

#hidenbox{border-top:1px solid transparent !important;border-top:0;clear:both;}

.bnt14{font-size:13px;font-family:宋体,Arial;line-height:18px;height:25px;}

--

/style

/head

html

body

center

form name="personalorder" action="preferences" method="POST"

div id="hd"

TABLE height=20 cellSpacing=0 cellPadding=0 width=714 align=center

border=0

TBODY

TR

TD height="60" vAlign=center DIV class=s5 align=center选择省市:

select name="prov" onchange="setInd(this)"

option value=0不预定/optionoption value=8610北京/optionoption value=8621上海/optionoption value=8622天津/optionoption value=8623重庆/optionoption value=86311河北/optionoption value=8625江苏/optionoption value=86571浙江/optionoption value=8620广东/optionoption value=86351山西/optionoption value=8624辽宁/optionoption value=86431吉林/optionoption value=86451黑龙江/optionoption value=86551安徽/optionoption value=86591福建/optionoption value=86791江西/optionoption value=86531山东/optionoption value=86371河南/optionoption value=8627湖北/optionoption value=86731 selected湖南/optionoption value=8628四川/optionoption value=86851贵州/optionoption value=86871云南/optionoption value=8629陕西/optionoption value=86931甘肃/optionoption value=86971青海/optionoption value=86471内蒙古/optionoption value=86771广西/optionoption value=86898海南/optionoption value=86891西藏/optionoption value=86951宁夏/optionoption value=86991新疆/optionoption value=88610台湾/optionoption value=85210香港/optionoption value=85310澳门/option/SELECT

选择城市:

SELECT name=locid

OPTION value=86731731长沙/OPTIONOPTION value=86731730岳阳/OPTIONOPTION value=86731732湘潭/OPTIONOPTION value=86731733株洲/OPTIONOPTION value=86731734衡阳/OPTIONOPTION value=86731735郴州/OPTIONOPTION value=86731736常德/OPTIONOPTION value=86731737益阳/OPTIONOPTION value=86731738娄底/OPTIONOPTION value=86731739邵阳/OPTIONOPTION value=86731743 selected吉首/OPTIONOPTION value=86731745怀化/OPTIONOPTION value=86731746永州/OPTION

/SELECT

/DIV

script

function cls_inpt(){

var _inpt=document.getElementsByTagName("input");

for(var i=0;i_inpt.length;i++){

if(_inpt[i].name.indexOf('stockid')=0 ||_inpt[i].name.indexOf('showname')=0 ||_inpt[i].name.indexOf('stockname')=0){

_inpt[i].value='';

}

}

return false;

}

cityarray0 = new Array(

"0;不预定");

cityarray8610 = new Array(

"861010;北京");

cityarray8621 = new Array(

"862121;上海");

cityarray8622 = new Array(

"862222;天津");

cityarray8623 = new Array(

"862323;重庆",

"86232314;万州",

"8623810;涪陵");

cityarray86311 = new Array(

"86311311;石家庄",

"86311310;邯郸",

"86311312;保定",

"86311313;张家口",

"86311314;承德",

"86311315;唐山",

"86311316;廊坊",

"86311317;沧州",

"86311318;衡水",

"86311319;邢台",

"86311335;秦皇岛");

cityarray8625 = new Array(

"862525;南京",

"8625510;无锡",

"8625511;镇江",

"8625512;苏州",

"8625513;南通",

"8625514;扬州",

"8625515;盐城",

"8625516;徐州",

"8625517;淮安",

"862551701;淮阴",

"8625518;连云港",

"8625519;常州",

"8625523;泰州",

"8625527;宿迁");

cityarray86571 = new Array(

"86571571;杭州",

"86571570;衢州",

"86571572;湖州",

"86571573;嘉兴",

"86571574;宁波",

"86571575;绍兴",

"86571576;台州",

"86571577;温州",

"86571578;丽水",

"86571579;金华",

"86571580;舟山");

cityarray8620 = new Array(

"862020;广州",

"8620660;汕尾",

"8620662;阳江",

"8620663;揭阳",

"8620668;茂名",

"8620750;江门",

"8620751;韶关",

"8620752;惠州",

"8620753;梅州",

"8620754;汕头",

"8620755;深圳",

"8620756;珠海",

"8620757;佛山",

"8620758;肇庆",

"8620759;湛江",

"8620760;中山",

"8620762;河源",

"8620763;清远",

"8620766;云浮",

"8620768;潮州",

"8620769;东莞");

cityarray86351 = new Array(

"86351351;太原",

"86351349;朔州",

"86351350;忻州",

"86351352;大同",

"86351353;阳泉",

"86351354;榆次",

"86351355;长治",

"86351356;晋城",

"86351357;临汾",

"86351358;吕梁",

"86351359;运城");

cityarray8624 = new Array(

"862424;沈阳",

"8624410;铁岭",

"8624411;大连",

"8624412;鞍山",

"8624413;抚顺",

"8624414;本溪",

"8624415;丹东",

"8624416;锦州",

"8624417;营口",

"8624418;阜新",

"1378819;辽阳",

"8624421;朝阳",

"8624427;盘锦",

"8624429;葫芦岛");

cityarray86431 = new Array(

"86431431;长春",

"86431432;吉林",

"86431434;四平",

"86431435;通化",

"86431436;白城",

"86431437;辽源",

"86431438;松原",

"86431439;白山");

cityarray86451 = new Array(

"86451451;哈尔滨",

"86451452;齐齐哈尔",

"86451453;牡丹江",

"86451454;佳木斯",

"86451455;绥化",

"86451456;黑河",

"86451458;伊春",

"86451459;大庆",

"86451464;七台河",

"86451467;鸡西",

"86451468;鹤岗",

"86451469;双鸭山",

"86451470;大兴安岭");

cityarray86551 = new Array(

"86551551;合肥",

"86551550;滁州",

"86551552;蚌埠",

"86551553;芜湖",

"86551554;淮南",

"86551555;马鞍山",

"86551556;安庆",

"86551557;宿州",

"86551558;阜阳",

"8655155801;亳州",

"86551559;黄山",

"86551561;淮北",

"86551562;铜陵",

"86551563;宣城",

"86551564;六安",

"86551565;巢湖",

"86551566;池州");

cityarray86591 = new Array(

"86591591;福州",

"86591592;厦门",

"86591593;宁德",

"86591594;莆田",

"86591595;泉州",

"86591596;漳州",

"86591597;龙岩",

"86591598;三明",

"86591599;南平");

cityarray86791 = new Array(

"86791791;南昌",

"86791701;鹰潭",

"86791790;新余",

"86791792;九江",

"86791793;上饶",

"86791794;抚州",

"86791795;宜春",

"86791796;吉安",

"86791797;赣州",

"86791798;景德镇",

"86791799;萍乡");

cityarray86531 = new Array(

"86531531;济南",

"86531530;菏泽",

"86531532;青岛",

"86531533;淄博",

"86531534;德州",

"86531535;烟台",

"86531536;潍坊",

"86531537;济宁",

"86531539;临沂",

"86531543;滨州",

"86531546;东营",

"86531631;威海",

"86531632;枣庄",

"86531633;日照",

"86531634;莱芜",

"86531635;聊城");

cityarray86371 = new Array(

"86371371;郑州",

"86371370;商丘",

"86371372;安阳",

"86371373;新乡",

"86371374;许昌",

"86371375;平顶山",

"86371376;信阳",

"86371377;南阳",

"86371378;开封",

"86371379;洛阳",

"86371391;焦作",

"86371392;鹤壁",

"86371393;濮阳",

"86371394;周口",

"86371395;漯河",

"86371396;驻马店",

"86371398;三门峡");

cityarray8627 = new Array(

"862727;武汉",

"8627710;襄樊",

"8627711;鄂州",

"8627712;孝感",

"8627713;黄冈",

"8627714;黄石",

"8627715;咸宁",

"8627716;荆州",

"8627717;宜昌",

"8627718;恩施",

"8627719;十堰",

"8627722;随州",

"8627724;荆门");

cityarray86731 = new Array(

"86731731;长沙",

"86731730;岳阳",

"86731732;湘潭",

"86731733;株洲",

"86731734;衡阳",

"86731735;郴州",

"86731736;常德",

"86731737;益阳",

"86731738;娄底",

"86731739;邵阳",

"86731743;吉首",

"86731745;怀化",

"86731746;永州");

cityarray8628 = new Array(

"862828;成都",

"8628812;攀枝花",

"8628813;自贡",

"8628816;绵阳",

"8628817;南充",

"8628818;达州",

"8628825;遂宁",

"8628826;广安",

"8628827;巴中",

"8628830;泸州",

"8628831;宜宾",

"8628832;资阳",

"862883201;内江",

"8628833;乐山",

"862883301;眉山",

"862883401;凉山",

"8628835;雅安",

"862883701;阿坝",

"8628838;德阳",

"8628839;广元");

cityarray86851 = new Array(

"86851851;贵阳",

"86851852;遵义",

"86851853;安顺",

"86851854;都匀",

"86851855;凯里",

"86851856;铜仁",

"86851857;毕节",

"86851858;六盘水",

"86851859;兴义");

cityarray86871 = new Array(

"86871871;昆明",

"86871691;西双版纳",

"86871692;德宏",

"86871870;昭通",

"86871872;大理",

"8687187303;红河",

"86871874;曲靖",

"86871875;保山",

"86871876;文山",

"86871877;玉溪",

"86871878;楚雄",

"86871879;思茅",

"86871883;临沧",

"8687188601;怒江",

"8687188701;迪庆",

"86871888;丽江");

cityarray8629 = new Array(

"862929;西安",

"8629910;咸阳",

"8629911;延安",

"8629912;榆林",

"8629913;渭南",

"8629914;商洛",

"8629915;安康",

"8629916;汉中",

"8629917;宝鸡",

"8629919;铜川");

cityarray86931 = new Array(

"86931931;兰州",

"86931930;临夏",

"86931932;定西",

"86931933;平凉",

"86931934;庆阳",

"86931935;金昌",

"8693193501;武威",

"86931936;张掖",

"86931937;酒泉",

"8693193701;嘉峪关",

"86931938;天水",

"86931939;陇南",

"86931941;甘南",

"86931943;白银");

cityarray86971 = new Array(

"86971971;西宁",

"8697197001;海北",

"86971972;海东",

"8697197501;果洛",

"8697197301;黄南",

"86971976;玉树",

"86971979;格尔木",

"8697197901;海西");

cityarray86471 = new Array(

"86471471;呼和浩特",

"86471470;海拉尔",

"86471472;包头",

"86471473;乌海",

"86471474;集宁",

"86471475;通辽",

"86471476;赤峰",

"86471478;临河",

"86471479;锡林浩特",

"86471482;乌兰浩特",

"86471483;巴彦浩特",

"86471484;鄂尔多斯");

cityarray86771 = new Array(

"86771771;南宁",

"86771770;防城港",

"8677177101;崇左",

"86771772;柳州",

"8677177201;来宾",

"86771773;桂林",

"86771774;梧州",

"8677177401;贺州",

"86771775;玉林",

"8677177501;贵港",

"86771776,;百色",

"86771777,;钦州",

"86771778,;河池",

"86771779,;北海");

cityarray86898 = new Array(

"86898898;海口",

"86898899;三亚",

"8689889901;西沙群岛");

cityarray86891 = new Array(

"86891891;拉萨",

"86891892;日喀则",

"86891893;山南",

"86891894;林芝",

"86891895;昌都",

"86891896;那曲",

"86891897;阿里");

cityarray86951 = new Array(

"86951951;银川",

"86951952;石嘴山",

"86951953;吴忠",

"86951954;固原");

cityarray86991 = new Array(

"86991991;乌鲁木齐",

"86991901;塔城",

"86991902;哈密",

"86991903;和田",

"86991906;阿勒泰",

"8699190801;克州",

"86991909;博乐",

"86991990;克拉玛依",

"86991993;石河子",

"86991994;昌吉",

"86991995;吐鲁番",

"86991996;库尔勒",

"86991997;阿克苏",

"86991998;喀什",

"86991999;伊犁");

cityarray88610 = new Array(

"8861010;台北");

cityarray85210 = new Array(

"8521010;香港");

cityarray85310 = new Array(

"8531010;澳门");

function getCitiesFromProvinceID(provinceid) {

if (provinceid == 0) return cityarray0;

if (provinceid == 8610) return cityarray8610;

if (provinceid == 8621) return cityarray8621;

if (provinceid == 8622) return cityarray8622;

if (provinceid == 8623) return cityarray8623;

if (provinceid == 86311) return cityarray86311;

if (provinceid == 8625) return cityarray8625;

if (provinceid == 86571) return cityarray86571;

if (provinceid == 8620) return cityarray8620;

if (provinceid == 86351) return cityarray86351;

if (provinceid == 8624) return cityarray8624;

if (provinceid == 86431) return cityarray86431;

if (provinceid == 86451) return cityarray86451;

if (provinceid == 86551) return cityarray86551;

if (provinceid == 86591) return cityarray86591;

if (provinceid == 86791) return cityarray86791;

if (provinceid == 86531) return cityarray86531;

if (provinceid == 86371) return cityarray86371;

if (provinceid == 8627) return cityarray8627;

if (provinceid == 86731) return cityarray86731;

if (provinceid == 8628) return cityarray8628;

if (provinceid == 86851) return cityarray86851;

if (provinceid == 86871) return cityarray86871;

if (provinceid == 8629) return cityarray8629;

if (provinceid == 86931) return cityarray86931;

if (provinceid == 86971) return cityarray86971;

if (provinceid == 86471) return cityarray86471;

if (provinceid == 86771) return cityarray86771;

if (provinceid == 86898) return cityarray86898;

if (provinceid == 86891) return cityarray86891;

if (provinceid == 86951) return cityarray86951;

if (provinceid == 86991) return cityarray86991;

if (provinceid == 88610) return cityarray88610;

if (provinceid == 85210) return cityarray85210;

if (provinceid == 85310) return cityarray85310;

return new Array();

}

function fillInCities(provinceid) {

document.forms['personalorder']['locid'].length = 0;

var arr = getCitiesFromProvinceID(provinceid);

var cnt = 0;

var isSelected = false;

for(var n=0; narr.length; n++){

newOpt=new Option;

i = arr[n].search(';');

newOpt.text=arr[n].slice(i+1);

newOpt.value=arr[n].slice(0,i);

if (!isSelected){

//newOpt.selected = true;

isSelected = true;

}

document.forms['personalorder']['locid'].options[cnt]=newOpt;

cnt=cnt+1;

}

}

function GetSelectedText(box){

var boxText = '';

for(var i=0; ibox.options.length; i++){

if(box.options[i].selected box.options[i].value != ''){

boxText = box.options[i].value;

}

}

return boxText;

}

function setInd(box) {

ind = GetSelectedText(box);

if(ind != ''){

fillInCities(ind);

}

//alert(ind);

}

/script

/TD

/TR

/TBODY

/TABLE

/body

/html

用JS实现省市下拉框怎么做?

试试这个:

script language="JavaScript"

!--

var g_selProvince;

var g_selCity;

var Provinces=new Array(

new Array("110000","北京市"),

new Array("120000","天津市"),

new Array("130000","河北省"),

new Array("140000","山西省"),

new Array("150000","内蒙古自治区"),

new Array("210000","辽宁省"),

new Array("220000","吉林省"),

new Array("230000","黑龙江省"),

new Array("310000","上海市"),

new Array("320000","江苏省"),

new Array("330000","浙江省"),

new Array("340000","安徽省"),

new Array("350000","福建省"),

new Array("360000","江西省"),

new Array("370000","山东省"),

new Array("410000","河南省"),

new Array("420000","湖北省"),

new Array("430000","湖南省"),

new Array("440000","广东省"),

new Array("450000","广西壮族自治区"),

new Array("460000","海南省"),

new Array("500000","重庆市"),

new Array("510000","四川省"),

new Array("520000","贵州省"),

new Array("530000","云南省"),

new Array("540000","西藏自治区"),

new Array("610000","陕西省"),

new Array("620000","甘肃省"),

new Array("630000","青海省"),

new Array("640000","宁夏回族自治区"),

new Array("650000","新疆维吾尔自治区"),

new Array("710000","台湾省"),

new Array("810000","香港特别行政区"),

new Array("820000","澳门特别行政区")

);

var Citys=new Array(

new Array("110100","北京"),

new Array("120100","天津"),

new Array("130101","石家庄"),

new Array("130201","唐山"),

new Array("130301","秦皇岛"),

new Array("130701","张家口"),

new Array("130801","承德"),

new Array("131001","廊坊"),

new Array("130401","邯郸"),

new Array("130501","邢台"),

new Array("130601","保定"),

new Array("130901","沧州"),

new Array("133001","衡水"),

new Array("140101","太原"),

new Array("140201","大同"),

new Array("140301","阳泉"),

new Array("140501","晋城"),

new Array("140601","朔州"),

new Array("142201","忻州"),

new Array("142331","离石"),

new Array("142401","榆次"),

new Array("142601","临汾"),

new Array("142701","运城"),

new Array("140401","长治"),

new Array("150101","呼和浩特"),

new Array("150201","包头"),

new Array("150301","乌海"),

new Array("152601","集宁"),

new Array("152701","东胜"),

new Array("152801","临河"),

new Array("152921","阿拉善左旗"),

new Array("150401","赤峰"),

new Array("152301","通辽"),

new Array("152502","锡林浩特"),

new Array("152101","海拉尔"),

new Array("152201","乌兰浩特"),

new Array("210101","沈阳"),

new Array("210201","大连"),

new Array("210301","鞍山"),

new Array("210401","抚顺"),

new Array("210501","本溪"),

new Array("210701","锦州"),

new Array("210801","营口"),

new Array("210901","阜新"),

new Array("211101","盘锦"),

new Array("211201","铁岭"),

new Array("211301","朝阳"),

new Array("211401","锦西"),

new Array("210601","丹东"),

new Array("220101","长春"),

new Array("220201","吉林"),

new Array("220301","四平"),

new Array("220401","辽源"),

new Array("220601","浑江"),

new Array("222301","白城"),

new Array("222401","延吉"),

new Array("220501","通化"),

new Array("230101","哈尔滨"),

new Array("230301","鸡西"),

new Array("230401","鹤岗"),

new Array("230501","双鸭山"),

new Array("230701","伊春"),

new Array("230801","佳木斯"),

new Array("230901","七台河"),

new Array("231001","牡丹江"),

new Array("232301","绥化"),

new Array("230201","齐齐哈尔"),

new Array("230601","大庆"),

new Array("232601","黑河"),

new Array("232700","加格达奇"),

new Array("310100","上海"),

new Array("320101","南京"),

new Array("320201","无锡"),

new Array("320301","徐州"),

new Array("320401","常州"),

new Array("320501","苏州"),

new Array("320600","南通"),

new Array("320701","连云港"),

new Array("320801","淮阴"),

new Array("320901","盐城"),

new Array("321001","扬州"),

new Array("321101","镇江"),

new Array("330101","杭州"),

new Array("330201","宁波"),

new Array("330301","温州"),

new Array("330401","嘉兴"),

new Array("330501","湖州"),

new Array("330601","绍兴"),

new Array("330701","金华"),

new Array("330801","衢州"),

new Array("330901","舟山"),

new Array("332501","丽水"),

new Array("332602","临海"),

new Array("340101","合肥"),

new Array("340201","芜湖"),

new Array("340301","蚌埠"),

new Array("340401","淮南"),

new Array("340501","马鞍山"),

new Array("340601","淮北"),

new Array("340701","铜陵"),

new Array("340801","安庆"),

new Array("341001","黄山"),

new Array("342101","阜阳"),

new Array("342201","宿州"),

new Array("342301","滁州"),

new Array("342401","六安"),

new Array("342501","宣州"),

new Array("342601","巢湖"),

new Array("342901","贵池"),

new Array("350101","福州"),

new Array("350201","厦门"),

new Array("350301","莆田"),

new Array("350401","三明"),

new Array("350501","泉州"),

new Array("350601","漳州"),

new Array("352101","南平"),

new Array("352201","宁德"),

new Array("352601","龙岩"),

new Array("360101","南昌"),

new Array("360201","景德镇"),

new Array("362101","赣州"),

new Array("360301","萍乡"),

new Array("360401","九江"),

new Array("360501","新余"),

new Array("360601","鹰潭"),

new Array("362201","宜春"),

new Array("362301","上饶"),

new Array("362401","吉安"),

new Array("362502","临川"),

new Array("370101","济南"),

new Array("370201","青岛"),

new Array("370301","淄博"),

new Array("370401","枣庄"),

new Array("370501","东营"),

new Array("370601","烟台"),

new Array("370701","潍坊"),

new Array("370801","济宁"),

new Array("370901","泰安"),

new Array("371001","威海"),

new Array("371100","日照"),

new Array("372301","滨州"),

new Array("372401","德州"),

new Array("372501","聊城"),

new Array("372801","临沂"),

new Array("372901","菏泽"),

new Array("410101","郑州"),

new Array("410201","开封"),

new Array("410301","洛阳"),

new Array("410401","平顶山"),

new Array("410501","安阳"),

new Array("410601","鹤壁"),

new Array("410701","新乡"),

new Array("410801","焦作"),

new Array("410901","濮阳"),

new Array("411001","许昌"),

new Array("411101","漯河"),

new Array("411201","三门峡"),

new Array("412301","商丘"),

new Array("412701","周口"),

new Array("412801","驻马店"),

new Array("412901","南阳"),

new Array("413001","信阳"),

new Array("420101","武汉"),

new Array("420201","黄石"),

new Array("420301","十堰"),

new Array("420400","沙市"),

new Array("420501","宜昌"),

new Array("420601","襄樊"),

new Array("420701","鄂州"),

new Array("420801","荆门"),

new Array("422103","黄州"),

new Array("422201","孝感"),

new Array("422301","咸宁"),

new Array("422421","江陵"),

new Array("422801","恩施"),

new Array("430101","长沙"),

new Array("430401","衡阳"),

new Array("430501","邵阳"),

new Array("432801","郴州"),

new Array("432901","永州"),

new Array("430801","大庸"),

new Array("433001","怀化"),

new Array("433101","吉首"),

new Array("430201","株洲"),

new Array("430301","湘潭"),

new Array("430601","岳阳"),

new Array("430701","常德"),

new Array("432301","益阳"),

new Array("432501","娄底"),

new Array("440101","广州"),

new Array("440301","深圳"),

new Array("441501","汕尾"),

new Array("441301","惠州"),

new Array("441601","河源"),

new Array("440601","佛山"),

new Array("441801","清远"),

new Array("441901","东莞"),

new Array("440401","珠海"),

new Array("440701","江门"),

new Array("441201","肇庆"),

new Array("442001","中山"),

new Array("440801","湛江"),

new Array("440901","茂名"),

new Array("440201","韶关"),

new Array("440501","汕头"),

new Array("441401","梅州"),

new Array("441701","阳江"),

new Array("450101","南宁"),

new Array("450401","梧州"),

new Array("452501","玉林"),

new Array("450301","桂林"),

new Array("452601","百色"),

new Array("452701","河池"),

new Array("452802","钦州"),

new Array("450201","柳州"),

new Array("450501","北海"),

new Array("460100","海口"),

new Array("460200","三亚"),

new Array("510101","成都"),

new Array("513321","康定"),

new Array("513101","雅安"),

new Array("513229","马尔康"),

new Array("510301","自贡"),

new Array("500100","重庆"),

new Array("512901","南充"),

new Array("510501","泸州"),

new Array("510601","德阳"),

new Array("510701","绵阳"),

new Array("510901","遂宁"),

new Array("511001","内江"),

new Array("511101","乐山"),

new Array("512501","宜宾"),

new Array("510801","广元"),

new Array("513021","达县"),

new Array("513401","西昌"),

new Array("510401","攀枝花"),

new Array("500239","黔江土家族苗族自治县"),

new Array("520101","贵阳"),

new Array("520200","六盘水"),

new Array("522201","铜仁"),

new Array("522501","安顺"),

new Array("522601","凯里"),

new Array("522701","都匀"),

new Array("522301","兴义"),

new Array("522421","毕节"),

new Array("522101","遵义"),

new Array("530101","昆明"),

new Array("530201","东川"),

new Array("532201","曲靖"),

new Array("532301","楚雄"),

new Array("532401","玉溪"),

new Array("532501","个旧"),

new Array("532621","文山"),

new Array("532721","思茅"),

new Array("532101","昭通"),

new Array("532821","景洪"),

new Array("532901","大理"),

new Array("533001","保山"),

new Array("533121","潞西"),

new Array("533221","丽江纳西族自治县"),

new Array("533321","泸水"),

new Array("533421","中甸"),

new Array("533521","临沧"),

new Array("540101","拉萨"),

new Array("542121","昌都"),

new Array("542221","乃东"),

new Array("542301","日喀则"),

new Array("542421","那曲"),

new Array("542523","噶尔"),

new Array("542621","林芝"),

new Array("610101","西安"),

new Array("610201","铜川"),

new Array("610301","宝鸡"),

new Array("610401","咸阳"),

new Array("612101","渭南"),

new Array("612301","汉中"),

new Array("612401","安康"),

new Array("612501","商州"),

new Array("612601","延安"),

new Array("612701","榆林"),

new Array("620101","兰州"),

new Array("620401","白银"),

new Array("620301","金昌"),

new Array("620501","天水"),

new Array("622201","张掖"),

new Array("622301","武威"),

new Array("622421","定西"),

new Array("622624","成县"),

new Array("622701","平凉"),

new Array("622801","西峰"),

new Array("622901","临夏"),

new Array("623027","夏河"),

new Array("620201","嘉峪关"),

new Array("622102","酒泉"),

new Array("630100","西宁"),

new Array("632121","平安"),

new Array("632221","门源回族自治县"),

new Array("632321","同仁"),

new Array("632521","共和"),

new Array("632621","玛沁"),

new Array("632721","玉树"),

new Array("632802","德令哈"),

new Array("640101","银川"),

new Array("640201","石嘴山"),

new Array("642101","吴忠"),

new Array("642221","固原"),

new Array("650101","乌鲁木齐"),

new Array("650201","克拉玛依"),

new Array("652101","吐鲁番"),

new Array("652201","哈密"),

new Array("652301","昌吉"),

new Array("652701","博乐"),

new Array("652801","库尔勒"),

new Array("652901","阿克苏"),

new Array("653001","阿图什"),

new Array("653101","喀什"),

new Array("654101","伊宁"),

new Array("710001","台北"),

new Array("710002","基隆"),

new Array("710020","台南"),

new Array("710019","高雄"),

new Array("710008","台中"),

new Array("211001","辽阳"),

new Array("653201","和田"),

new Array("542200","泽当镇"),

new Array("542600","八一镇"),

new Array("820000","澳门"),

new Array("810000","香港")

);

function FillProvinces(selProvince)

{

selProvince.options[0]=new Option("请选择","000000");

for(i=0;iProvinces.length;i++)

{

selProvince.options[i+1]=new Option(Provinces[i][1],Provinces[i][0]);

}

selProvince.options[0].selected=true;

selProvince.length=i+1;

}

function FillCitys(selCity,ProvinceCode)

{

//if the province is a direct-managed city, like Beijing, shanghai, tianjin, chongqin,hongkong, macro

//need not "请选择选项"

if(ProvinceCode=="110000"||ProvinceCode=="120000"||ProvinceCode=="310000"

||ProvinceCode=="810000"||ProvinceCode=="820000"||ProvinceCode=="500000")

count=0;

else

{selCity.options[0]=new Option("请选择",ProvinceCode);

count=1;}

for(i=0;iCitys.length;i++)

{

if(Citys[i][0].toString().substring(0,2)==ProvinceCode.substring(0,2))

{

selCity.options[count]=new Option(Citys[i][1],Citys[i][0]);

count=count+1;

}

}

selCity.options[0].selected=true;

selCity.length=count;

}

function Province_onchange()

{

FillCitys(g_selCity,g_selProvince.value);

}

function InitCitySelect(selProvince,selCity)

{

//alert("begin");

g_selProvince=selProvince;

g_selCity=selCity;

selProvince.onchange=Function("Province_onchange();");

FillProvinces(selProvince);

Province_onchange();

}

function InitCitySelect2(selProvince,selCity,CityCode)

{

InitCitySelect(selProvince,selCity)

for(i=0;iselProvince.length;i++)

{

if(selProvince.options[i].value.substring(0,2)==CityCode.substring(0,2))

{

selProvince.options[i].selected=true;

}

}

Province_onchange();

for(i=0;iselCity.length;i++)

{

if(selCity.options[i].value==CityCode)

{

selCity.options[i].selected=true;

}

}

}

//--

/script

form name="profile" method="post" action="where.asp"

SELECT id=province size=1 name=province

OPTION selected/OPTION

/SELECT

SELECT id=city size=1 name=city

OPTION selected/OPTION

/SELECT

SCRIPT language=javascript

InitCitySelect(document.profile.province,document.profile.city);

/SCRIPT

input type="submit"

/form

如你要提取市的数据,你需要在接受请求页面写如下代码:

shi=trim(request.form("city"))

就可以得到市的值了。

还有这是用Form传递参数,而不是用QueryString传递。


网站名称:太原javascript,太原工业学院
标题网址:http://chengdu.cdxwcx.cn/article/dssehji.html