32 lines
804 B
HTML
32 lines
804 B
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Example 3.10</title>
|
|
<script>
|
|
function rateIt()
|
|
{
|
|
var rate = parseInt(prompt("Rate the site from 1 to 10, with 10 as the best"," "));
|
|
var grade = " "
|
|
if (rate == 10)
|
|
grade = "A";
|
|
else if (rate >= 7 && rate <= 9)
|
|
grade = "B";
|
|
else if (rate >= 4 && rate < 7)
|
|
grade = "C";
|
|
else
|
|
grade = "D";
|
|
document.write("<p>You gave the site a rating of " + grade + ".</p>");
|
|
}
|
|
</script>
|
|
</<head>
|
|
<body>
|
|
<table align ="center" width ="70%"><tr><td>
|
|
<h1> </h2>
|
|
<h1>Rate the Site</h1>
|
|
<h3>Rate the site from 1 to 10, with 10 as the best ever and 1 as one of the worst</h3>
|
|
<p><input type="button" id="rating" value="Enter your rating now" onclick="rateIt();" /></p>
|
|
</td></tr></table></body>
|
|
</html>
|
|
|