I have a question about generating HTMLpages using DOM and I have the some code to show my question, I try to create the new student with school.prototype.createStudent and the page don´t show anything and when the student is created I need it to appear in list of students with checkbox that when if I want to try to remove and see information, I need to select the students with select checkbox
And I need to follow this examples to create my scripts with DOMand Javascript
function Student(id) {
this.id = id;
}
function School(id) {
this.id = id;
this.index = 0;
this.students = [];
}
/*School.prototype.createStudent = function() {
this.students.push(new Student(this.index++);
};*/
function Unload_Document() {
var div = document.createElement("div");
div.id = "school";
var h1 = document.createElement("h1");
h1.style.color = "red";
var title = document.createTextNode("High School");
h1.appendChild(title);
var h3 = document.createElement("h3");
h3.style.color = "blue";
var subtitle = document.createTextNode("List Of Students:");
h3.appendChild(subtitle);
div.appendChild(h1);
div.appendChild(h3);
/*if (this.students.length !== 0) {
for (var i = 0; i < this.students.length; i++) {
var chkbox = document.createElement("input");
chkbox.type = "checkbox";
chkbox.name = "Student" + this.students[i].id;
chkbox.id = this.students[i].id;
div.appendChild(chkbox);
}
} else {
return " ";
}*/
var btnCreate = document.createElement("button");
var btnCreateText = document.createTextNode("Create");
btnCreate.appendChild(btnCreateText);
btnCreate.onclick = function() {
School.createStudent();
}
var btnRemove = document.createElement("button");
var btnRemoveText = document.createTextNode("Remove");
btnRemove.appendChild(btnRemoveText);
btnRemove.onclick = function() {
}
var btnInf = document.createElement("button");
var btnInfText = document.createTextNode("Student Information");
btnInf.appendChild(btnInfText);
btnInf.onclick = function() {
}
div.appendChild(btnCreate);
div.appendChild(btnRemove);
div.appendChild(btnInf);
document.body.appendChild(div);
};
window.onload = function() {
Unload_Document();
};
#school {
display: inline-table;
vertical-align: middle;
text-align: left;
}
[id] h1 {
font-size: 60px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
[id] h3 {
font-size: 40px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
[id] button {
margin: 2px;
background-color: #0000ff;
font-size: 14px;
font-weight: bold;
color: white;
}
<!DOCTYPE html>
<html lang="pt-PT">
<head>
<meta charset="UTF-8">
<title>High School</title>
</head>
<body>
<div id="school"></div>
</body>
</html>

DOMlike the image without add new codes in web page, or I need to create thescriptinhtmlpage,?