Semester 3 pog
This commit is contained in:
32
Semester 1/Assignments/JavaScript/ch03/ex_3_7.html
Executable file
32
Semester 1/Assignments/JavaScript/ch03/ex_3_7.html
Executable file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Example 3.7</title>
|
||||
<script>
|
||||
function shipCost()
|
||||
{
|
||||
var price = parseInt(prompt("What is your merchandise total?"," "));
|
||||
if (price > 1.00 && price < 25.00)
|
||||
var ship = 5.00;
|
||||
if (price >= 25.00 && price < 50.00)
|
||||
var ship = 7.00;
|
||||
if (price >= 50.00 && price < 75.00)
|
||||
var ship = 9.00;
|
||||
if (price >= 75.00 && price < 100.00)
|
||||
var ship = 10.00;
|
||||
if (price >= 100.00)
|
||||
var ship = 0.00;
|
||||
document.write("<p>Your shipping cost will be $ " + ship + ".</p>");
|
||||
}
|
||||
</script>
|
||||
</<head>
|
||||
<body>
|
||||
<table align ="center" width ="70%"><tr><td>
|
||||
<h1> </h2>
|
||||
<h1>Calculating Shipping Costs</h1>
|
||||
<h3>Click the button to calculate your shipping cost</h3>
|
||||
<p><input type="button" id="ship" value="calculate your shipping charge" onclick="shipCost();" /></p>
|
||||
</td></tr></table></body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user