JS code randomly generated name, cell phone number, ID number, bank card number _javascript skills

Source: Internet
Author: User

Development test, often need to fill in the name, mobile phone number, ID card number, bank card number, both in line with the format requirements, and can not repeat. People will search the internet for all kinds of generators.

The following small series of their own write a JS generator code. Randomly generated name, mobile phone number, ID card number, bank card number of the JS code.

Generate Random names

function GetName () {var familynames = new Array ("Zhao", "Money", "Sun", "Li", "Zhou", "WU", "Zheng", "Wang", "Feng", "Chen", "Chu", "Wei", "Chiang", "Shen", " Han "," Yang "," Zhu "," Qin "," especially "," Xu "," Ho "," Lu "," Shi "," Zhang "," Hole "," Cao "," Yan "," Hua "," Jin "," Wei "," Tao "," Ginger "," qi "," Xie "," Zou "," Yu "," Bai "," Water "," sinus "," chapter "," Cloud "," Sue "," Pan "," GE "," Xi "," fan "," Peng "," Lang "," Lu "," Wei "," Chang "," Ma "," Miao "," Feng "," Flowers "," Fang "," Yu "," Ren "," Yuan "," Liu "," Feng "," Bao "," history "  , "Tang", "Fei", "Lian", "cen", "Xue", "Lei", "he", "ni", "Soup", "teng", "Yin", "Luo", "bi", "Hao", "WU", "Ann", "Chang", "le", "in", "when", "Fu", "Skin", "Bian", "Qi",
"Kang", "WU", "Yu", "Yuan", "bu", "gu", "Meng", "ping", "Huang", "and", "Mu", "Xiao", "Yin"); var givennames = new Array ("Zi Xuan", "Miao", "Guodong", "Master," Reidon "," Sweet "," min "," Shang "," Guo Yin "," Hexiang "," Chen Tao "," Hao Xuan "," Yi Xuan "," Yi Chen "," Yi Fan "," Yi Ran "," Jin Chun, "Jin Kun", "Chun Qi", "Yang", "Wen Hao", "Dongdong", "Male Lin", "Hao Morning", "Hee-han," Rongrong "," Ice Maple "," Xinxin "," Hao "," Xin Hui "," Jian Zheng "," Mei Xin "," Accomplishment Hui "," he Attributes "," Wen Jie "," Xin Source "," loyal Lin "," Banyan Run "," Yan Ru "," Hui Jia "," new "," Jian Lin "," also Phenanthrene "," Lin "," Ice Jie, "Jia Xin", "Han Han", "Yu Chen", "Chummi", "Ze Hui", "Wai Yang", "Han Yue", "Embellish Li", "Xiang", "Shuhua", "Crystal", "Lingjing" , "Yara Creek", "Rain Culvert," Jia Yi "," Jia Yi "," Zi Chen "," Jia Qi "," Purple Xuan "," Rui Chen "," Xin Rui "," Meng "," Mingyuan "," Hin Yi "," Ze far"," Hin Yi "," Jia Yi "," Jia Hui "," Morning XI "," Morning Jade "," Yun Hao "," Ru Xin "," Shu Jun "," Crystal 滢 "," "Embellish The Sally", "Banyan Shan", "Jia Yu", "Good Jade", "Xiao Qing", "Yi Ming", "Language Morning", "Add Pool", "Tim Hao", "Rain Ze", "Ya 晗
"," Ya Han "," Qing Yan "," Poem Yue "," Jia le "," Chen Han "," Tian-ji "," Yue Ao "," Jia Hao "," Tian Hao "," Meng Meng "," if Meng ");
var i = parseint (* math.random ()) * + parseint (* math.random ());
var familyname = familynames[i];
var j = parseint (* math.random ()) * + parseint (* math.random ());
var givenname = givennames[i];
var name = familyname + givenname;
var x = document.getelementsbyname ("Client_name");  for (var i =; i < x.length; i++) {var o = x[i]; o.value = name;}}

Generate a random phone number

function getmoble () {
var prefixarray = new Array ("130", "131", "132", "133", "135", "137", "138", "170", "187", "189" );
var i = parseint (A * math.random ());
var prefix = prefixarray[i];
for (var j = 0; J < 8; J +) {
prefix = prefix + math.floor (math.random () *);
}
var x = document.getelementsbyname ("Mobile_tel");
for (var i = 0; i < x.length i++) {
var o = x[i];
O.value = prefix;
}

Generate a random ID number

function Getid_no () {
var coefficientarray = ["7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4" , "2"];//weighted factor
var lastnumberarray = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];//check code
var address = "420101" "; Address
var birthday = "19810101";//Birthday
var s = Math.floor (Math.random () *10). ToString () + Math.floor (Math.random () *10). ToString () + Math.floor (Math.random () *10). ToString ();
var array = (address + birthday + s). Split (""); 
var total = 0;
For (i in array) {Total
= total + parseint (Array[i]) *parseint (Coefficientarray[i]);
} 
var lastnumber = Lastnumberarray[parseint (total%11)];
var id_no_string = address + birthday + S + lastnumber;
var x = document.getelementsbyname ("Id_no");
for (var i = 0; i < x.length i++) {
var o = x[i];
O.value = id_no_string;
}

Generate a random bank card number

function Getbank_account () {var bank_no = document.getElementById ("Bank_no_select"). Value;
var prefix = ""; Switch (bank_no) {case "0102": prefix = "622202", break, Case "0103": prefix = "622848", break, Case "0105": prefix = "62
2700 ";
Break
Case "0301": prefix = "622262"; 
Break
Case "the": prefix = "621661"; 
Break
Case "0303": prefix = "622666";
Break
Case "305": prefix = "622622";
Break
Case "0306": prefix = "622556";
Break
Case "0308": prefix = "622588";
Break
Case "0410": prefix = "622155";
Break
Case "302": prefix = "622689";
Break
Case "304": prefix = "622630";
Break
Case "309": prefix = "622908";
Break
Case "310": prefix = "621717";
Break
Case "315": prefix = "622323";
Break
Case "316": prefix = "622309"; 
Break Default: for (var j = 0; J < + j) {prefix = prefix + math.floor (math.random () *);} var x = Document.geteleme
Ntsbyname ("Bank_no"); for (var i = 0; i < x.length i++) {var o = x[i]; o.value = Bank_no;} var y = Document.getelementsbynaMe ("Bank_account"); for (var i = 0; i < y.length i++) {var o = y[i]; o.value = prefix;}}

The above code is JS randomly generated name, mobile phone number, ID card number, bank card number of all the content, the code is relatively simple, there are any questions welcome to my message, small series will be in time to reply to you, but also thank you for your support of cloud Habitat Community website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.