ASDV-WebDev/Semester 1/Chapter ZIPs/JavaScript/ch8/ex_8_7.html

19 lines
469 B
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Example 8.7</title>
<script type="text/javascript">
var names = new Array();
var numStud = prompt("How many students are in the class? ");
numStud = parseInt(numStud);
var i = 0;
for (i = 0; i <= numStud - 1; i++)
{
names[i]= prompt("Enter the student's name: ");
document.write("Name of student " + (i + 1) + ": " + names[i] + "<br />");
}
</script>
</head>
<body>
</body></html>