我最近在这里发布了一个问题
答题者的工作做得非常好,但是现在我正尝试在代码中添加一些内容,但是它不起作用,我已经完成了所有可能的调试,但是它并不会显示总数!这是我的HTML
<label for ="FIELD7">Would you like Weapons?: </label> <label for="FIELD7">Yes</label> <input type="radio" id="weaponyes" name="FIELD7" value="Yes" onclick="doMath()" checked data-clicked="no" /> <label for="FIELD7">No</label> <input type="radio" id ="weaponno" name="FIELD7" value="No" />
这是我的jQuery``` function doMath() { var basePrice = 15;
var baseModel = 0; var customModel = 5; var modelTotal; if (document.querySelector('input[name="FIELD6"]:checked').value == "Normal Model") { modelTotal = basePrice; } if (document.querySelector('input[name="FIELD6"]:checked').value == "Workshop Model") { modelTotal = customModel; } var weaponTotal; var weapons = 5; if(document.querySelector('input[name="FIELD7"]:checked').value == "Yes") { weaponTotal = weapons; } else(document.querySelector('input[name="FIELD7"]:checked').value == "No") { weaponTotal = 0; } var totalPrice = modelTotal + weaponTotal; console.log(totalPrice); document.getElementById('total').innerHTML = '<span style="color:black">Total Price:' + totalPrice + '</span>'; } </script>
```我已经弄清楚了模型的一部分,我只需要有关“ var vesselTotal;”的帮助。开始。它不再显示价格了:(