导航:首页 > 编程语言 > js省份

js省份

发布时间:2023-02-15 03:07:05

1. 谁有js下拉选择省份,城市,地区(英文)

你好 我只有中的 省市联动 ··贴上代码 供你做参考吧
//省份数组
var shenArr=["请选择省份/城市","北京市","上海市","天津市","重庆市","香港特别行政区","澳门特别行政区","湖南","辽宁","河北","山东","河南","湖北","福建","四川","江西"];
//自定义下标(属性)
//shenArr["名称"]
shenArr["请选择省份/城市"]=["请选择城市/地区"];
shenArr["北京市"]=["北京市"];
shenArr["上海市"]=["上海市"];
shenArr["天津市"]=["天津市"];
shenArr["重庆市"]=["重庆市"];
shenArr["香港特别行政区"]=["香港特别行政区"];
shenArr["澳门特别行政区"]=["澳门特别行政区"];
shenArr["福建"]=["福州市","厦门市","泉州市","漳州市","南平市","三明市","龙岩市","莆田市"];
shenArr["湖南"]=["长沙市","株洲市","湘潭市","郴州市","益阳市","娄底市","衡阳市","常德市"];
shenArr["辽宁"]=["沈阳市","大连市","抚顺市","鞍山市","铁岭市","本溪市","丹东市","锦州市"];
shenArr["河北"]=["保定市","唐山市","邯郸市","邢台市","沧州市","衡水市","廊坊市","承德市"];
shenArr["山东"]=["济南市","青岛市","威海市","潍坊市","菏泽市","济宁市","莱芜市","烟台市"];
shenArr["河南"]=["洛阳市","焦作市","商丘市","信阳市","周口市","鹤壁市","安阳市","濮阳市"];
shenArr["湖北"]=["武汉市","荆门市","汉口市","咸宁市","襄樊市","荆州市","黄石市","孝感市"];
shenArr["江西"]=["南昌市","赣州市","上饶市","宜春市","吉安市","抚州市","萍乡市","九江市"];

$.each(shenArr,function(i,val){
//添加下拉项
$("select[name=sheng]").append("<option value='"+val+"'>"+val+"</option>");

});

//市级下拉框绑定
$("select[name=sheng]").change(function(){
var index=$(this).val();
var shiArr=shenArr[index];
$("select[name=shi]").empty();
$.each(shiArr,function(i,val){
//添加下拉项
$("select[name=shi]").append("<option value='"+val+"'>"+val+"</option>");
});
});

<select name="sheng"></select> 
<select name="shi">
<option>请选择城市/地区</option>
</select>
希望能帮到你 谢谢

2. 29_用js实现一个省市级联效果

(1)var provs={},存储省市的json结构数据。

(2)function loadProv() {},此函数实现了初始化页面加载数据的功能。

(3)var prov = document.getElementById("prov"),获取存放省份的select下拉菜单。

(4)for (var key in provs),遍历json结构数据。

(5)var provName = key,获取省份的名称。

(6)var optProv = document.createElement("option"),创建一个option元素对象。

(7)optProv.value = provName,设置option元素的value属性值。

(8)optProv.innerText = provName,设置option显示的文本内容。

(9)prov.appendChild(optProv),将option元素添加到select下拉菜单。

(10)function provChange() {},作为onchange事件处理函数。

(11)var prov = document.getElementById("prov"),获取省份下拉菜单。

(12)var city = document.getElementById("city"),获取城市下拉菜单。

(13)var provName = prov.value,获取当前选中的省份的value值。

(14)if (provName == "none") {

city.style.display = "none";

return;

},如果值等于none,说明选中的是第一项,那么城市下拉菜单还是具有隐藏状态,并跳出函数。

(15)else {

city.style.display = "";

},否则的话显示出城市下拉菜单,默认状态它是隐藏的。

(16)var citys = provs[provName],获取城市,citys是个数组。

(17)for (var index = city.childNodes.length - 1; index >= 0; index--) {

var child = city.childNodes[index];

city.removeChild(child);

},遍历城市下拉菜单下的option元素,然后删除这些元素。

之所以清空就是为了防止当再次加载的时候出现累加情况。

(18)for (var index = 0; index < citys.length; index++) {},遍历数组中的元素,也就是城市。

(19)var optCity = document.createElement("option"),创建option元素。

(20)optCity.value = citys[index],设置option元素的value值。

(21)optCity.innerText = citys[index],设置option元素的文本内容。

(22)city.appendChild(optCity),将option元素添加select下拉菜单。

数据表形式数据

json形式数据

3. 如何利用js的话,如何得到省所对应的市,然后在放后数组中

您好:这个是典型的省级联动的效果。给你说思路吧:首先把所有省份写到数组中。格式如下{{"山东":{"济南","青岛","淄博"}},{"山东":{"济南","青岛","淄博"}}
然后就根据省份那个下拉列表中选中的省份,得到他下面的城市,让在第二个下拉列表中就可以了。

4. JS省份下拉框,怎样提取江浙沪到前三个

一般这个列表的内容,是由一个数组来填充的,要将江浙沪提到前三位,
找到这个数组的赋值定义那段,将江浙沪三个放到数组赋值的前三个,不就可以了

5. JS是什么意思

英文缩写(计算机) JS = javaScript
明星组合 JS = Justin和Sophia, 哥哥——陈忠义 (Justin) 和 妹妹——陈绮萱 (Sophia)
拼音(网络用语)

JS=Jin Sha,金莎,中国大陆流行人气女歌手和当红女艺人,2005年发行首张个人音乐专辑 《空气》后迅速串红;曾于师兄林俊杰合唱林俊杰创作的第一首男女对唱情歌——《被风吹过的夏天》而家喻户晓。而后在《神话》中扮演吕素自编一首《星月神话》在网络榜单占据16周之久。气质清纯,嗓音甜美的金莎,近年来转战影视界,成功主演了《幸福的眼泪》、《大城市小浪漫》、《神话》等多部热播大剧而成为内地娱乐圈红人。
JS = Jian Shang,奸商,指代了一群特殊人群,他们通过倒卖游戏中的各种装备材料等来获取丰厚的利润。现在JS更多用以指代现实中的奸商特别是攒机商,但是网友立场几乎一边倒地站在商家反方,于是无论商家好坏都叫JS。随着IT业发展,攒机商利润已经很薄,这种对立情绪也淡了很多。但是代称还是没有变,JS逐渐演变成“商家”的一种代称,有一种戏谑的成分。
JS=Jiang Su,江苏,我国东部的一个省份。经常用在江苏某个机构的缩写名称中,如JSBC代表江苏广电总台。
JS = Jian Shi,剑侍,QQ三国中精通战斗技巧的勇士,以剑为武器。低命中、高闪避、高爆击是剑侍的特色。他们还懂得如何更有效的激怒敌人,控制战斗节奏。如何在短时间秒杀敌人才是一名剑侍应该考虑的事情。
JS = Jiang Shi,僵尸,反恐精英Online中生化模式中的僵尸阵营;JavaScript代码有时也称作僵尸代码。
JS = Ji Si,祭司,春秋Q传中具有着无上高贵气质的秦青一直是列国诸侯争相膜拜的对象,传说她已经传承了上古天神女娲的神圣法术,可赋予人类强大的生存力量。
JS = Jia Su,加速线,衡量股价涨速的工具,加速线指标上升表明股价上升动力增加,加速线指标下降表明股价下降压力增加。
JS = Ji Shi,桑拿里技师的意思。
JS = Jun Shi,俊士,欧珀莱一款男性化妆品系列。
JS = Ju Xing, “聚星天华”自2006年1月推出第一个产品至今,经过一年时间,现已成为青春流行纸媒领域最著名的品牌标志之一。js这一用语多见于网络贴吧内。
JS= jian sheng “剑圣”魔兽争霸中兽人英雄,英文缩写为BM,因为疾风步的原因,又美其名曰“贱圣”

其他

JS = JSharer, 极享网盘,ACG迷的主流网盘。
JS = jiān shāng 网络用语,代指奸商 JS = Jack Sparrow 加勒比海盗里的杰克船长

6. 省份必填 js 校验

<SCRIPT LANGUAGE="JavaScript">
<!-- ###中国省市二级联动菜单开始##如有问题请到www.blog.sina.com.cn/hulei0217 QQ 347993010 [email protected]找我!##
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]).selectedIndex>0 || !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>

7. 淘宝的js省市区联动菜单是怎么做的

源码里面要记得放省事等数据 要json的格式

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>省市区三级联动</title>
</head>
<body>
<form>
<select id="province">
<option>请选择省份</option>
</select>
<select id="city">
<option>请选择城市</option>
</select>
<select id="district">
<option>请选择区域</option>
</select>
</form>
<script src="json.js"></script>
<script type="text/javascript">
var proData = [],
cityData = [],
distData = [];
var proSelect = document.getElementById("province"),
citySelect = document.getElementById("city"),
districtSelect = document.getElementById("district");
var curPro = "",
curCity = "";
// 封装更新选择列表函数
function fillselect(select,list){
for (var i = select.length-1; i > 0 ; i--){
select.remove(i);
}
list.forEach(function(data){
var option = new Option(data.name, data.sheng);
option.dataset.di = data.di;
select.add(option);
})
}
// 将数据按省、市、地区分别存储
dataJson.forEach(function(data){
if (data.level === 1){
proData.push(data);
}
if (data.level === 2){
cityData.push(data);
}
if (data.level === 3){
distData.push(data);
}
})
fillselect(proSelect,proData);
// 监听一级省份选择列表change事件,更新二级城市列表
proSelect.addEventListener("change",function(event){
var val = event.target.value;
var list = [];
cityData.forEach(function(d){
if (d.sheng === val) {
list.push(d);
}
})
fillselect(citySelect,list);
})
// 监听二级城市选择列表change事件,更新三级区域列表
citySelect.addEventListener("change",function(event){
var val = event.target.value;
var curIndex = event.target.selectedIndex;
curCity = event.target[curIndex].dataset.di;
console.log(event.target,curCity);
var list = [];
distData.forEach(function(d){
if (d.di === curCity && d.sheng === val) {
list.push(d);
}
})
fillselect(districtSelect,list);
})
</script>
</body>
</html>

8. js是江苏的缩写,hn是哪个省份的缩写啊

应该是海南,河南,二者之一

阅读全文

与js省份相关的资料

热点内容
wt是什么文件 浏览:75
孩子出生证能在什么网站找到吗 浏览:465
java日期compare 浏览:120
深州有哪个编程学校好 浏览:826
抖音数据中心怎么才算合格 浏览:540
全栈视频数据是什么 浏览:787
网上少儿编程哪个好些 浏览:132
oracle数据库优化方法 浏览:844
怎么关闭网络唤醒 浏览:894
孤单的微信头像动漫 浏览:305
有没有哪个大学教编程 浏览:851
wordpress后台添加广告位置 浏览:491
怎样快速修改qq密码 浏览:145
怎么清除恶意攻击网站 浏览:511
qq头像女生侧颜马尾 浏览:718
苹果自己的文件格式 浏览:85
放在c盘的app如何删除 浏览:912
华为手机克隆后文件放在哪里 浏览:631
清乐网站制作需要多少人 浏览:294
网络游戏系统 浏览:933

友情链接