drWhoZygonNames.js (1185B)
1 var nm1 = ["B", "Br", "Cr", "D", "Dr", "G", "Gr", "K", "Kr", "R", "S", "Sr", "Str", "St", "T", "Tr", "V", "Vr"]; 2 var nm2 = ["e", "a", "o"]; 3 var nm3 = ["d", "g", "k", "l", "m", "n", "s", "t", "v", "w", "z"]; 4 var nm4 = ["l", "m", "n", "r", "rm", "rn", "s", "st"]; 5 6 function nameGen() { 7 $('#placeholder').css('textTransform', 'capitalize'); 8 var br = ""; 9 var element = document.createElement("div"); 10 element.setAttribute("id", "result"); 11 for (i = 0; i < 10; i++) { 12 rnd = Math.floor(Math.random() * nm1.length); 13 rnd2 = Math.floor(Math.random() * nm2.length); 14 rnd3 = Math.floor(Math.random() * nm3.length); 15 rnd4 = Math.floor(Math.random() * nm2.length); 16 rnd5 = Math.floor(Math.random() * nm4.length); 17 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5]; 18 br = document.createElement('br'); 19 element.appendChild(document.createTextNode(names)); 20 element.appendChild(br); 21 } 22 if (document.getElementById("result")) { 23 document.getElementById("placeholder").removeChild(document.getElementById("result")); 24 } 25 document.getElementById("placeholder").appendChild(element); 26 }