計算ボタンを押しても出力が得られないようです。欠けているのは単純なことだとはわかっていますが、一日中頭を悩ませていて、正しく動作させることができないようです。これは私の更新されたコードであり、まだ機能しません。
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function calc(){
var price = document.getElementById("price");
var shipping=parseFloat(calc(price));
var total= price+shipping;
if (price<=25){
return 1.5;
}
else{
return price*10/100
}
window.alert("Your total price with shipping and handling is $" + price + ".");
}
</script>
</head>
<body>
<form name="total" action="">
Enter your amount:
<input type="text" name="price" id="price">
<input type="button"
value="calculate"
onclick="calc(document.getElementById("price")">
</form>
</body>
</html>