ch04
This commit is contained in:
34
Chapter ZIPs/JavaScript/ch04/ex_4_7.html
Executable file
34
Chapter ZIPs/JavaScript/ch04/ex_4_7.html
Executable file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Example 4.7</title>
|
||||
<script>
|
||||
function getPlayers()
|
||||
{
|
||||
var player = prompt("Enter the name of a player:"," ");
|
||||
var points = prompt("Enter the points this player has:"," ");
|
||||
document.write('<h1> </h1>');
|
||||
document.write('<table width="40%" border="1" align = "center">');
|
||||
while (player != "done")
|
||||
{
|
||||
document.write('<tr>');
|
||||
document.write('<td width="50">' + player + '</td>');
|
||||
document.write('<td width = "50">' + points + '</td>');
|
||||
document.write('</tr>');
|
||||
player = prompt("Enter the name of a player or enter 'done' when you're finished:"," ");
|
||||
points = prompt("Enter the points this player has or 0 if finished:"," ");
|
||||
}
|
||||
document.write('</table>');
|
||||
}
|
||||
</script>
|
||||
</<head>
|
||||
<body>
|
||||
<table align ="center" width ="70%"><tr><td colspan ="2">
|
||||
<h1> </h2>
|
||||
<h1>Today's Players</h1>
|
||||
<h3>Click to enter players' names</h3>
|
||||
<p><input type="button" id="players" value="Enter today's players" onclick="getPlayers();" /></p>
|
||||
</td></tr>
|
||||
</table></body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user