Click for a FREE quote from Delaware Insurance Advisors

Test

function generator(){
// Add your own words to the wordlist. Be carefull to obey the showed syntax
var adjectives = ["Cool","Masked","Bloody","Lame"]
var animals = ["Hamster","Moose","Lama","Duck"]

// Random numbers are made
var randomNumber1 = parseInt(Math.random() * adjectives.length);
var randomNumber2 = parseInt(Math.random() * animals.length);
var name = adjectives[randomNumber1] + " " + animals[randomNumber2];

alert(name); //Delete this when the below works

//If there's already a name it is removed
if(document.getElementById("result")){
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
// A div element is created to show the generated name.
//The Name is added as a textnode. Textnode is added to the placeholder.
var element = document.createElement("div");
element.setAttribute("id", "result");
element.appendChild(document.createTextNode(name));
document.getElementById("placeholder").appendChild(element);
}