You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.7 KiB
JavaScript

var nm1 = ["Aardvark", "Albatross", "Alligator", "Alpaca", "Ant", "Antelope", "Ape", "Armadillo", "Axolotl", "Baboon", "Badger", "Bat", "Bear", "Beaver", "Beetle", "Bison", "Boar", "Bobcat", "Bongo", "Bull", "Camel", "Cat", "Chameleon", "Chicken", "Cow", "Coyote", "Crane", "Crow", "Dingo", "Dog", "Donkey", "Dragon", "Eagle", "Elephant", "Falcon", "Ferret", "Flamingo", "Fox", "Frog", "Gibbon", "Gnu", "Goat", "Goose", "Gopher", "Gorilla", "Hawk", "Hog", "Horse", "Hyena", "Kangaroo", "Koala", "Lemur", "Leopard", "Lion", "Llama", "Lynx", "Macaw", "Manatee", "Mantis", "Marmot", "Mole", "Moose", "Mouse", "Newt", "Octopus", "Ostrich", "Otter", "Owl", "Ox", "Panda", "Parrot", "Pelican", "Penguin", "Pheasant", "Pig", "Possum", "Quail", "Rabbit", "Raccoon", "Rat", "Rhino", "Salamander", "Scorpion", "Seal", "Shark", "Sheep", "Skunk", "Slug", "Snake", "Spider", "Squid", "Squirrel", "Stork", "Swan", "Tiger", "Turtle", "Wasp", "Whale", "Wolf", "Wombat"];
function nameGen() {
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm1.length | 0;
while (nm1[rnd] === nm1[rnd2]) {
rnd2 = Math.random() * nm1.length | 0;
}
names = nm1[rnd] + " " + nm1[rnd2];
br = document.createElement('br');
element.appendChild(document.createTextNode(names));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
}