您好,我对此很陌生,我正在尝试使此运输计算器代码正常工作。这就是我到目前为止所拥有的。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
ent"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Calculate Shipping</title>
<script type="text/javascript">
/* <![CDATA[ */
var price = 0;
var shipping = (calculateShipping(price););
var total = price + shipping;
function calculateShipping(price){
if (price <= 25){
return 1.5;
}
else {
return price * 10 / 100;
break;
}
}
window.alert("Your total is $" + total + ".");
/* ]]> */
</script>
</head>
<body>
<form name="shipping" action="">
<p>Purchase Price: $
<input type="text" name="price" />
<input type="button" value="Calculate Shipping" onclick="calculateshipping(price);" />
</p>
</form>
</body>
</html>