JavaScript根据国家二字码获取国家全称

  1 function getCountryNameByCode(code) {
  2     var countryName = ‘‘;
  3     switch(code) {
  4     case "US":
  5         countryName = "United State";
  6         break;
  7     case "GB":
  8         countryName = "United Kingdom";
  9         break;
 10     case "DE":
 11         countryName = "Germany";
 12         break;
 13     case "CA":
 14         countryName = "Canada";
 15         break;
 16     case "JP":
 17         countryName = "Japan";
 18         break;
 19     case "ES":
 20         countryName = "Spain";
 21         break;
 22     case "FR":
 23         countryName = "France";
 24         break;
 25     case "IT":
 26         countryName = "Italy";
 27         break;
 28     case "CN":
 29         countryName = "China";
 30         break;
 31     case "AT":
 32         countryName = "Austria";
 33         break;
 34     case "AU":
 35         countryName = "Australian";
 36         break;
 37     case "CH":
 38         countryName = "Switzerland";
 39         break;
 40     case "EG":
 41         countryName = "Egypt";
 42         break;
 43     case "FI":
 44         countryName = "Finland";
 45         break;
 46     case "IN":
 47         countryName = "India";
 48         break;
 49     case "IE":
 50         countryName = "Ireland";
 51         break;
 52     case "ID":
 53         countryName = "Indonesia";
 54         break;
 55     case "KH":
 56         countryName = "Cambodia";
 57         break;
 58     case "KR":
 59         countryName = "Korea";
 60         break;
 61     case "MX":
 62         countryName = "Mexico";
 63         break;
 64     case "NL":
 65         countryName = "Holland";
 66         break;
 67     case "NO":
 68         countryName = "Norway";
 69         break;
 70     case "MM":
 71         countryName = "Burma";
 72         break;
 73     case "PH":
 74         countryName = "Philippines";
 75         break;
 76     case "BE":
 77         countryName = "Belgium";
 78         break;
 79     case "GY":
 80         countryName = "Guyana";
 81         break;
 82     case "SE":
 83         countryName = "Sweden";
 84         break;
 85     case "PY":
 86         countryName = "Paraguay";
 87         break;
 88     case "UA":
 89         countryName = "Ukraine";
 90         break;
 91     case "PE":
 92         countryName = "Peru";
 93         break;
 94     case "AE":
 95         countryName = "United Arab Emirates";
 96         break;
 97     case "VN":
 98         countryName = "Vietnam";
 99         break;
100     case "SO":
101         countryName = "Somalia";
102         break;
103     case "LA":
104         countryName = "Laos";
105         break;
106     case "KW":
107         countryName = "Kuwait";
108         break;
109     case "MY":
110         countryName = "Malaysia";
111         break;
112     case "DK":
113         countryName = "Denmark";
114         break;
115     case "PK":
116         countryName = "Pakistan";
117         break;
118     case "TH":
119         countryName = "Thailand";
120         break;
121     case "HU":
122         countryName = "HUNGARY";
123         break;
124     case "LV":
125         countryName = "Latvia";
126         break;
127     case "RU":
128         countryName = "Russia";
129         break;
130     case "CZ":
131         countryName = "Czech Republic";
132         break;
133     case "PL":
134         countryName = "Poland";
135         break;
136     case "BY":
137         countryName = "Belarus";
138         break;
139     case "LT":
140         countryName = "Lithuania";
141         break;
142     case "LU":
143         countryName = "Luxembourg";
144         break;
145     case "AD":
146         countryName = "Andorra";
147         break;
148     case "AG":
149         countryName = "Antigua and Barbuda";
150         break;
151     case "RO":
152         countryName = "Romania";
153         break;
154     case "AM":
155         countryName = "Armenia";
156         break;
157     case "CV":
158         countryName = "Cape Verde";
159         break;
160     case "DZ":
161         countryName = "Algeria";
162         break;
163     case "RT":
164         countryName = "Rota (Northern Mariana Islands)";
165         break;
166     case "TL":
167         countryName = "Timor-Leste";
168         break;
169     case "MU":
170         countryName = "Mauritius";
171         break;
172     case "ZM":
173         countryName = "Zambia";
174         break;
175     case "BL":
176         countryName = "St. Barthelemy";
177         break;
178     case "SX":
179         countryName = "St. Maarten, St. Martin";
180         break;
181     case "BH":
182         countryName = "Bahrain";
183         break;
184     case "GM":
185         countryName = "Gambia";
186         break;
187     case "MV":
188         countryName = "Maldives";
189         break;
190     case "CK":
191         countryName = "Cook Islands";
192         break;
193     case "RE":
194         countryName = "Reunion Island";
195         break;
196     case "IQ":
197         countryName = "Iraq";
198         break;
199     case "GD":
200         countryName = "Grenada";
201         break;
202     case "FM":
203         countryName = "Micronesia, Federated States of";
204         break;
205     case "VE":
206         countryName = "Venezuela";
207         break;
208     case "NC":
209         countryName = "New Caledonia";
210         break;
211     case "NP":
212         countryName = "Nepal";
213         break;
214     case "MD":
215         countryName = "Moldova";
216         break;
217     case "VA":
218         countryName = "Vatican City (Italy)";
219         break;
220     case "GP":
221         countryName = "Guadeloupe";
222         break;
223     case "GU":
224         countryName = "Guam";
225         break;
226     case "NA":
227         countryName = "Namibia";
228         break;
229     case "QA":
230         countryName = "Qatar";
231         break;
232     case "YT":
233         countryName = "Mayotte";
234         break;
235     case "ME":
236         countryName = "Montenegro";
237         break;
238     case "BT":
239         countryName = "Bhutan";
240         break;
241     case "UZ":
242         countryName = "Uzbekistan";
243         break;
244     case "WF":
245         countryName = "Wallis & Futuna Islands";
246         break;
247     case "JO":
248         countryName = "Jordan";
249         break;
250     case "MK":
251         countryName = "Macedonia (FYROM)"
252         break;
253     case "BF":
254         countryName = "Burkina Faso";
255         break;
256     case "NE":
257         countryName = "Niger";
258     case "WL":
259         countryName = "Wales (United Kingdom)";
260         break;
261     case "GE":
262         countryName = "Georgia";
263         break;
264     case "IS":
265         countryName = "Iceland";
266         break;
267     case "ER":
268         countryName = "Eritrea";
269         break;
270     case "KM":
271         countryName = "Comoros";
272         break;
273     case "SN":
274         countryName = "Senegal";
275         break;
276     case "EE":
277         countryName = "Estonia";
278         break;
279     case "MO":
280         countryName = "Macau";
281         break;
282     case "SI":
283         countryName = "Slovenia";
284         break;
285     case "UG":
286         countryName = "Uganda";
287         break;
288     case "ZW":
289         countryName = "Zimbabwe";
290         break;
291     case "TD":
292         countryName = "Chad";
293         break;
294     case "GL":
295         countryName = "Greenland";
296         break;
297     case "AF":
298         countryName = "Afghanistan";
299         break;
300     case "CD":
301         countryName = "Congo, Democratic Republic of";
302         break;
303     case "MN":
304         countryName = "Mongolia";
305         break;
306     case "MR":
307         countryName = "Mauritania";
308         break;
309     case "CO":
310         countryName = "Colombia";
311         break;
312     case "TT":
313         countryName = "Trinidad & Tobago";
314         break;
315     case "SF":
316         countryName = "Scotland (United Kingdom)";
317         break;
318     case "CF":
319         countryName = "Central African Republic";
320         break;
321     case "GI":
322         countryName = "Gibraltar";
323         break;
324     case "KY":
325         countryName = "Cayman Islands";
326         break;
327     case "NI":
328         countryName = "Nicaragua";
329         break;
330     case "TG":
331         countryName = "Togo";
332         break;
333     case "GQ":
334         countryName = "Equatorial Guinea";
335         break;
336     case "KN":
337         countryName = "St. Kitts and Nevis";
338         break;
339     case "ZZ":
340         countryName = "Tortola (British Virgin Islands)";
341         break;
342     case "TZ":
343         countryName = "Tanzania, United Republic of";
344         break;
345     case "KE":
346         countryName = "Kenya";
347         break;
348     case "MH":
349         countryName = "Marshall Islands";
350         break;
351     case "KZ":
352         countryName = "Kazakhstan";
353         break;
354     case "SA":
355         countryName = "Saudi Arabia";
356         break;
357     case "BN":
358         countryName = "Brunei Darussalam";
359         break;
360     case "SY":
361         countryName = "Syrian Arab Republic";
362         break;
363     case "HN":
364         countryName = "Honduras";
365         break;
366     case "PG":
367         countryName = "Papua New Guinea";
368         break;
369     case "HT":
370         countryName = "Haiti";
371         break;
372     case "SM":
373         countryName = "San Marino";
374         break;
375     case "MW":
376         countryName = "Malawi";
377         break;
378     case "CM":
379         countryName = "Cameroon";
380         break;
381     case "MG":
382         countryName = "Madagascar";
383         break;
384     case "PT":
385         countryName = "Portugal";
386         break;
387     case "CR":
388         countryName = "Costa Rica";
389         break;
390     case "BM":
391         countryName = "Bermuda";
392         break;
393     case "SR":
394         countryName = "Suriname";
395         break;
396     case "SB":
397         countryName = "Solomon Islands";
398         break;
399     case "TA":
400         countryName = "Tahiti (French Polynesia)";;
401         break;
402     case "CW":
403         countryName = "Curacao";
404         break;
405     case "TW":
406         countryName = "Taiwan";
407         break;
408     case "SL":
409         countryName = "Sierra Leone";
410         break;
411     case "TU":
412         countryName = "Truk (Micronesia, Federated States of)";
413         break;
414     case "UI":
415         countryName = "Union Islands (St. Vincent & the Grenadines)";
416         break;
417     case "VL":
418         countryName = "St. Thomas (U.S. Virgin Islands)";
419         break;
420     case "NF":
421         countryName = "Norfolk Island (Australia)";
422         break;
423     case "GT":
424         countryName = "Guatemala";
425         break;
426         break;
427     case "BG":
428         countryName = "Bulgaria";
429         break;
430         break;
431     case "PO":
432         countryName = "Ponape (Micronesia, Federated States of)";
433         break;
434     case "AW":
435         countryName = "Aruba";
436         break;
437     case "EC":
438         countryName = "Ecuador";
439         break;
440     case "RS":
441         countryName = "Serbia";
442         break;
443     case "BS":
444         countryName = "Bahamas";
445         break;
446     case "BO":
447         countryName = "Bolivia";
448         break;
449     case "PW":
450         countryName = "Palau";
451         break;
452     case "KG":
453         countryName = "Kirghizia (Kyrgyzstan)";
454         break;
455     case "TC":
456         countryName = "Turks & Caicos Islands";
457         break;
458     case "LC":
459         countryName = "St. Lucia";
460         break;
461     case "AZ":
462         countryName = "Azerbaijan";
463         break;
464     case "MT":
465         countryName = "Malta";
466         break;
467     case "BI":
468         countryName = "Burundi"
469         break;
470     case "AO":
471         countryName = "Angola";
472         break;
473     case "CY":
474         countryName = "Cyprus";
475         break;
476     case "BR":
477         countryName = "Brazil";
478         break;
479     case "WS":
480         countryName = "Samoa Western";
481         break;
482     case "AX":
483         countryName = "Aland Island (Finland)";
484         break;
485     case "LR":
486         countryName = "Liberia";
487         break;
488     case "FO":
489         countryName = "Faroe Islands";
490         break;
491     case "UV":
492         countryName = "St. John (U.S. Virgin Islands)";
493         break;
494     case "SG":
495         countryName = "Singapore";
496         break;
497     case "NG":
498         countryName = "Nigeria";
499         break;
500     case "PA":
501         countryName = "Panama";
502         break;
503     case "DJ":
504         countryName = "Djibouti";
505         break;
506     case "SZ":
507         countryName = "Swaziland";
508         break;
509     case "DO":
510         countryName = "Dominican Republic";
511         break;
512     case "KO":
513         countryName = "Kosrae (Micronesia, Federated States of)";
514         break;
515     case "MZ":
516         countryName = "Mozambique";
517         break;
518     case "AS":
519         countryName = "American Samoa";
520         break;
521     case "UY":
522         countryName = "Uruguay";
523         break;
524     case "KT":
525         countryName = "republic of ivory coast";
526         break;
527     case "AL":
528         countryName = "Albania";
529         break;
530     case "CG":
531         countryName = "Congo";
532         break;
533     case "AI":
534         countryName = "Anguilla";
535         break;
536     case "RW":
537         countryName = "Rwanda";
538         break;
539     case "GR":
540         countryName = "Greece";
541         break;
542     case "BW":
543         countryName = "Botswana";
544         break;
545     case "HR":
546         countryName = "Croatia";
547         break;
548     case "SC":
549         countryName = "Seychelles";
550         break;
551     case "NZ":
552         countryName = "New Zealand";
553         break;
554     case "PF":
555         countryName = "French Polynesia";
556         break;
557     case "ML":
558         countryName = "Mali";
559         break;
560     case "VU":
561         countryName = "Vanuatu";
562         break;
563     case "MP":
564         countryName = "Northern Mariana Islands";
565         break;
566     case "TR":
567         countryName = "Turkey";
568         break;
569     case "BA":
570         countryName = "Bosnia and Herzegovina";
571         break;
572     case "LY":
573         countryName = "Libyan Arab Jamahiriya";
574         break;
575     case "SV":
576         countryName = "El Salvador";
577         break;
578     case "TN":
579         countryName = "Tunisia";
580         break;
581     case "SW":
582         countryName = "St. Christopher (St. Kitts)";
583         break;
584     case "AR":
585         countryName = "Argentina";
586         break;
587     case "YE":
588         countryName = "Yemen, Republic of";
589         break;
590     case "TJ":
591         countryName = "Tajikistan";
592         break;
593     case "GA":
594         countryName = "Gabon";
595         break;
596     case "FJ":
597         countryName = "Fiji";
598         break;
599     case "GN":
600         countryName = "Guinea";
601         break;
602     case "GH":
603         countryName = "Ghana";
604         break;
605     case "BD":
606         countryName = "Bangladesh";
607         break;
608     case "TV":
609         countryName = "Tuvalu";
610         break;
611     case "YA":
612         countryName = "Yap (Micronesia, Federated States of)";
613         break;
614     case "LI":
615         countryName = "Liechtenstein";
616         break;
617     case "SP":
618         countryName = "Saipan (Northern Mariana Islands)";
619         break;
620     case "LB":
621         countryName = "Lebanon";
622         break;
623     case "MQ":
624         countryName = "Martinique";
625         break;
626     case "ZA":
627         countryName = "South Africa";
628         break;
629     case "BJ":
630         countryName = "Benin";
631         break;
632     case "OM":
633         countryName = "Oman";
634         break;
635     case "TO":
636         countryName = "Tonga";
637         break;
638     case "SK":
639         countryName = "Slovakia";
640         break;
641     case "BB":
642         countryName = "Barbados";
643         break;
644     case "MA":
645         countryName = "Morocco";
646         break;
647     case "IL":
648         countryName = "Israel";
649         break;
650     case "LK":
651         countryName = "Sri Lanka";
652         break;
653     case "BQ":
654         countryName = "Bonaire, St. Eustatius, Saba";
655         break;
656     case "PR":
657         countryName = "Puerto Rico";
658         break;
659     case "MS":
660         countryName = "Montserrat";
661         break;
662     case "TM":
663         countryName = "Turkmenistan";
664         break;
665     case "KI":
666         countryName = "Kiribati";
667         break;
668     case "GW":
669         countryName = "Guinea-Bissau";
670         break;
671     case "IC":
672         countryName = "Canary Islands (Spain)";
673         break;
674     case "GF":
675         countryName = "French Guiana";
676         break;
677     case "LS":
678         countryName = "Lesotho";
679         break;
680     case "JE":
681         countryName = "Jersey (Channel Islands)";
682         break;
683     case "DM":
684         countryName = "Dominica";
685         break;
686     case "ET":
687         countryName = "Ethiopia";
688         break;
689     case "BZ":
690         countryName = "Belize";
691         break;
692     case "GG":
693         countryName = "Guernsey (Channel Islands)"
694     case "JM":
695         countryName = "Jamaica";
696         break;
697     case "NB":
698         countryName = "Northern Ireland (United Kingdom)";
699         break;
700     case "CL":
701         countryName = "Chile";
702         break;
703     case "SD":
704         countryName = "Sudan";
705         break;
706     case "CI":
707         countryName = "ivory coast";
708         break;
709     case "AN":
710         countryName = "NETHERLANDS ANTILLES";
711         break;
712     case "CC":
713         countryName = "COCOS(KEELING) ISLANDS";
714         break;
715     case "CU":
716         countryName = "CUBA";
717         break;
718     case "MC":
719         countryName = "Monaco";
720         break;
721     case "VC":
722         countryName = "St. Vincent & the Grenadines";
723         break;
724     case "HK":
725         countryName = "HONGKONG";
726         break;
727     default:
728         countryName = code;
729         break;
730     };
731     if(countryName) {
732         return countryName.toUpperCase();
733     };
734     return countryName;
735 };

原文地址:https://www.cnblogs.com/zhc-hnust/p/10278910.html

时间: 2024-11-08 21:48:22

JavaScript根据国家二字码获取国家全称的相关文章

国家二字码对照表

中文国家名 英文国家名 大洲 二位简码 法属南部领地 French Southern Territories Europe TF 夏威夷 Hawaii North America HW 阿拉斯加 Alaska North America AK 新西兰属土岛屿 New Zealand Islands Territories Oceania XL 加罗林群岛 Caroline Islands Asia XK 巴利阿里群岛 Balearic Islands Europe XJ 马德拉群岛 Madeir

网页授权——扫二维码获取openid

最近做微信公众平台开发项目时遇到这样一个功能需求:生成一个特定url的二维码,用户扫描二维码后跳转到这个url指定的页面,并在这个页面获得用户的openid.这个功能主要涉及到两方面的技术:生成二维码,网页授权. 1. 生成二维码: 生成二维码比较简单的方法是直接使用phpqrcode程序包(可在网上下载得到). 若想获得ThinkPHP支持,需将程序包放在ThinkPHP/Extend/Vendor目录下,让后在程序中引用,代码如下: vendor("phpqrcode.phpqrcode&q

微信公众平台开发教程(六)获取个性二维码

微信公众平台开发教程(六)获取个性二维码 一.功能介绍 在进行推广时,我们可以告诉对方,我们的微信公众账号是什么,客户可以去搜索,然后关注.二维码给我们提供了极大的便捷,只要简单一扫描,即可关注. 如果已经关注过,立刻跳入对话画面.在我们进行推广时,不再是简陋的文字,可以是一个有个性的二维码,想必会很生动. 微信对二维码提供了很好的支持,而且还可以根据需要生成不同场景的二维码.下面我们将介绍如何获取和使用二维码. 注意:限服务号,且进行了微信认证,费用300 二.相关接口 为了满足用户渠道推广分

公众号获取推广二维码问题(获取access_token的时侯报错access_token is invalid or not latest hints)

这个问题,网上的回复有的是通过更新开发者密码(AppSecret)搞定的,有的是拼写错误改正了的.我这边这个问题都不是,几年前做的时侯没太留意,把网上的代码拷贝过来改改就出结果了,这次遇到的问题其实是几个基本概念要再次明确,微信在这种api文档上描述得很轻描淡写. 参考微信的文档:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html 几个重要的点罗列一下:(注意

【转】Android 二维码 生成和识别(附Demo源码)--不错

原文网址:http://www.cnblogs.com/mythou/p/3280023.html 今天讲一下目前移动领域很常用的技术——二维码.现在大街小巷.各大网站都有二维码的踪迹,不管是IOS.Android.WP都有相关支持的软件.之前我就想了解二维码是如何工作,最近因为工作需要使用相关技术,所以做了初步了解.今天主要是讲解如何使用ZXing库,生成和识别二维码.这篇文章实用性为主,理论性不会讲解太多,有兴趣可以自己查看源码. 1.ZXing库介绍 这里简单介绍一下ZXing库.ZXin

Force.com微信开发系列(八)生成带二维码的参数

为了满足用户渠道推广分析的需要,公众平台提供了生成带二维码的接口.使用该接口可以获得多个带不同场景值的二维码,用户扫描后,公众号可以接收到事件推送.目前有两种类型的二维码,分别是临时二维码和永久二维码,前者有过期时间,最大为1800秒,但能够生成较多数量,后者无过期时间,数量较少(目前参数只支持1到100000).两种二维码分别适用于账号绑定.用户来源统计等场景. 用户扫描带场景值二维码时,可能推送以下两种事件: 1. 如果用户还未关注公众号,则用户可以关注公众号,关注后微信会将带场景值关注事件

微信公众平台功能开发(生成带参数的二维码)

为了满足用户渠道推广分析的需要,公众平台提供了生成带参数二维码的接口.使用该接口可以获得多个带不同场景值的二维码,用户扫描后,公众号可以接收到事件推送. 目前有2种类型的二维码,分别是临时二维码和永久二维码,前者有过期时间,最大为1800秒,但能够生成较多数量,后者无过期时间,数量较少(目前参数只支持1--100000).两种二维码分别适用于帐号绑定.用户来源统计等场景. 用户扫描带场景值二维码时,可能推送以下两种事件: 如果用户还未关注公众号,则用户可以关注公众号,关注后微信会将带场景值关注事

用微信二维码登录自己的网站

地址:http://www.cnblogs.com/loogn/p/3727953.html用微信二维码登录自己的网站 一.当用户选择用微信二维码登录时,我们要在用户页面里生成一个guid做为客户端的唯一标识,然后带着这个guid请求二维码图片地址,得到地址后,显示给用户.请求到后台的时候要将此二维码的Key和客户端的guid关联到一起.注意这个key的生成方式,要保证多人同时用二维码登录而不冲突,比如用10000自增,隔断时间又重置到10000. 二.得到二维码后,马上发出长链接请求登录标识(

Java实现简单二维码制作

二维码概述 我们生活中使用到二维码的场景: 二维码概念 二维条码/二维码(2-dimensional bar code)是用某种特定的几何图形按一定规律在平面(二维方向上)分布的黑白 相间的图形记录数据符号信息的图形. 在代码编制上巧妙地利用构成计算机内部逻辑基础的"0"."1"比特流的概念,使用若干个与二进制相对应的几何 形体来表示文字数值信息,通过图象输入设备或光电扫描设备自动识读以实现信息自动处理:它具有条码技术的一些 共性:每种码制有其特定的字符集:每个字符