我正在尝试计算项目的付款金额。
我对javascript的经验很少,所以我还在学习。当我尝试计算时,我最终得到了NaN。
echo 'Hello ' . htmlspecialchars($_GET["your-name"]);
echo '<br>Your email address is ' . htmlspecialchars($_GET["your-email"]);
echo '<br>Your mobile number is ' . htmlspecialchars($_GET["text-904"]);
echo '<br>Your landline number is ' . htmlspecialchars($_GET["text-834"]);
echo '<br>Your total debt is £' . htmlspecialchars($_GET["text-706"]);
echo '<br>Your monthly income is £' . htmlspecialchars($_GET["text-134"]);
echo '<br>Your outgoings are £' . htmlspecialchars($_GET["text-175"]) . ' per month';
echo '<p id="amount">' . htmlspecialchars($_GET["text-706"]) . '</p>';
echo '<p id="payment"></p>';
<script>
num1 = document.getElementById("amount").value;
var x = 10;
var y = 5000;
var d = 48;
var e = num1 / x;
var f = e + y;
var z = f / d;
document.getElementById("payment").innerHTML = z;
</script>