document.addEventListener("DOMContentLoaded", function(e){
var students = ["Andy", "Richie", "Claire", "John", "Brian", "Allison"],
detentions = {};
function Dick(){
this.giveDetention = function(name, howLong){
detentions[name] = detentions[name] === undefined ? 1 : detentions[name] + 1;
var textDiv = document.createElement("div");
if(detentions[name] === 1){
textDiv.innerHTML = name + ": detention";
}
else{
textDiv.innerHTML = name + ": another one. Had enough yet?";
}
document.body.appendChild(textDiv);
};
}
function learnAndRejoice(){
var div = document.createElement("div");
var img = document.createElement("img");
img.src = "http://gifsoup.com/webroot/animatedgifs3/1871013_o.gif";
div.appendChild(img);
document.body.appendChild(div);
}
function credits(){
var a = document.createElement("a");
a.href = ";
a.innerHTML = "Don't You Forget About Me"
document.body.appendChild(a);
}
var principal = new Dick();
for(var i=0; i<6; ++i){
principal.giveDetention(students[i]);
}
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
learnAndRejoice();
credits();
}, false);
var students = ["Andy", "Richie", "Claire", "John", "Brian", "Allison"],
detentions = {};
function Dick(){
this.giveDetention = function(name, howLong){
detentions[name] = detentions[name] === undefined ? 1 : detentions[name] + 1;
var textDiv = document.createElement("div");
if(detentions[name] === 1){
textDiv.innerHTML = name + ": detention";
}
else{
textDiv.innerHTML = name + ": another one. Had enough yet?";
}
document.body.appendChild(textDiv);
};
}
function learnAndRejoice(){
var div = document.createElement("div");
var img = document.createElement("img");
img.src = "http://gifsoup.com/webroot/animatedgifs3/1871013_o.gif";
div.appendChild(img);
document.body.appendChild(div);
}
function credits(){
var a = document.createElement("a");
a.href = ";
a.innerHTML = "Don't You Forget About Me"
document.body.appendChild(a);
}
var principal = new Dick();
for(var i=0; i<6; ++i){
principal.giveDetention(students[i]);
}
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
principal.giveDetention("John");
learnAndRejoice();
credits();
}, false);