50 lines
1.5 KiB
HTML
50 lines
1.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<title>Example 4.8</title>
|
|
<script>
|
|
function getStuff()
|
|
{
|
|
document.write('<table width="40%" align = "center">');
|
|
var num = 0;
|
|
var item = " ";
|
|
document.write('<h1> </h1>');
|
|
|
|
while (num < 10)
|
|
{
|
|
item = prompt("What do you choose for item number " + (num + 1) + "?");
|
|
document.write('<tr>');
|
|
document.write('<td>item ' + (num + 1) + ' : ' + item + '</td>');
|
|
document.write('</tr>');
|
|
num = num + 1;
|
|
|
|
}
|
|
document.write('</table>');
|
|
}
|
|
</script>
|
|
</<head>
|
|
<body>
|
|
<table align ="center" width ="70%"><tr><td colspan ="2">
|
|
<h1> </h2>
|
|
<h1>Select Your Gear for the Game</h1>
|
|
<p>You are allowed to pick up to 10 items from the following list before the game begins:</p>
|
|
<table width = "60%">
|
|
<tr><td colspan="2"><h3 align="center">Supplies Available</h3></td></tr>
|
|
<tr><td>bag of food (1-day supply)</td><td>bottle of water (1-day supply)</td></tr>
|
|
<tr><td>sword</td><td>shield</td></tr>
|
|
<tr><td>kevlar vest</td><td>hunting knife</td></tr>
|
|
<tr><td>bow with 1 quiver of arrows</td><td>10 extra arrows</td></tr>
|
|
<tr><td>backpack</td><td>slingshot</td></tr>
|
|
<tr><td>box of 5 firestarters</td><td>pet goat</td></tr>
|
|
<tr><td>falcon</td><td>falconer's gloves</td></tr>
|
|
<tr><td>notebook</td><td>pen and pencil set</td></tr>
|
|
<tr><td>walking stick</td><td>hammer</td></tr>
|
|
<tr><td>shovel</td><td>1-person tent</td></tr>
|
|
</table>
|
|
<tr><td><p> </p>
|
|
<p><input type="button" id="gear" value="Click to enter your selections" onclick="getStuff();" /></p>
|
|
</td></tr>
|
|
</table></body>
|
|
</html>
|
|
|