I am new to JavaScript, I find it interesting and tedious at the same time. I have to write a script that calculates the shipping and handling cost of random items. If the purchase price is less than or equal to $25.00 then the shipping cost is $1.50, if the purchase price is $25.00 or more then you add 10% to the total price without including the $1.50 minimum shipping. Here is the script I have written so far and it is turning into a ball of confusion coupled with not working at all. I can't use document write it has to be a window alert and it has to be in a form.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Shipping and Handling Charge</title>
<script type="text/javascript">
/*<![CDATA[*/
		   var purchasePrice= 25.00;
		   function applyShipping(){
			   var shippingPrice= 1.50;
			   var totalCost= purchasePrice + shippingPrice;
			   window.alert("<p>The purchase price is $"
							  + purchasePrice + "<br/>"); // prints successfully
			   window.alert("The shipping price is $"
							  + shippingPrice + "<br/>"); // prints successfully
			   window.alert("The purchase price plus shipping is $"
							  + totalCost + "</p>"); // prints successfully
		   }
			   
/*]]>*/
</script>
</head>

<body>
<script type="text/javascript">
/*<![CDATA[*/
		   
var shippingPrice= 1.50;
function applyShipping(){
	if(purchasePrice<=25.00);
	window.alert("Total cost of the order");
	else
		if(purchasePrice>25.00);
		applyShipping(purchasePrice * 10/100);
	window.alert("Total cost of the order");
}
<div style="text-align: center">
<form name="Calculate Shipping" action="">
<input type="text box" name="amount"/><br/>
</form>
</div>
/*]]>*/
</script>
</body>
</html>