29 lines
879 B
HTML
29 lines
879 B
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Example 4.24</title>
|
||
|
<script>
|
||
|
function getBracelet()
|
||
|
{
|
||
|
var bracelets = (prompt("How many bracelets do you want?"," "));
|
||
|
var check = bracelets % 1;
|
||
|
while ((isNaN(bracelets)) || (check != 0) || (bracelets < 0))
|
||
|
{
|
||
|
bracelets = prompt("Please enter a positive whole number. How many bracelets do you want?"," ");
|
||
|
var check = bracelets % 1;
|
||
|
}
|
||
|
document.getElementById("theOrder").innerHTML ="<h3>You are ordering " + bracelets + " bracelets.<br /> Thank you.</h3>";
|
||
|
}
|
||
|
</script>
|
||
|
</<head>
|
||
|
<body>
|
||
|
<table align ="center" width ="70%" ><tr><td colspan ="2">
|
||
|
<h1> </h2>
|
||
|
<h1>Order Your Bracelets Now!</h1>
|
||
|
<p><input type="button" id="bracelets" value="Order bracelets" onclick="getBracelet();" /></p>
|
||
|
</td></tr>
|
||
|
<tr><td id="theOrder"><p> </p></td></tr>
|
||
|
</table></body>
|
||
|
</html>
|
||
|
|