gpt4 book ai didi

javascript - 销售税 (JavaScript)

转载 作者:行者123 更新时间:2023-12-02 15:31:18 27 4
gpt4 key购买 nike

我需要一项事件的帮助。我不断收到同样的错误,我不明白为什么会出现这种情况。

这是问题、我收到的错误和我的代码。

<html>

<body>
<script type="text/javascript">
// Program name: salesTaxLookup.html
// Purpose:
// Author:
// Date last modified: October 20th 2015

//variables and constants
var salesTax // tax
var purchases; // purchase
var BR = "<br />"; // HTML line break
var PA = "<p />"; // HTML paragraph break
var ES = ""; // empty string for prompt

// welcome the user
document.write("Welcome to sales tax calculator!" + PA);
salesTax = prompt("Enter your total amount of salesTax: ", ES);
salesTax = parseFloat(salesTax);

// calculate

if(salesTax <=0)
if(salesTax<=7) {
document.write("No tax." + BR);
}
else if (salesTax<=21){
document.write("1 cent tax." + BR);
}
else if (salesTax<=35){
document.write("2 cent tax." + BR);
}
else if (salesTax<=49){
document.write("3 cent tax." + BR);
}
else if (salesTax<=64){
document.write("4 cents tax." + BR);
else if (salesTax<=78) {
document.write("5 cents tax." + BR);
}
else if (salesTax<=92) {
document.write("6 cents tax." + BR);
}
else if (salesTax<=99){
document.write("7 cents tax." + BR)
}
</script>
</body>
</html>

The error I'm getting Description of the activity

最佳答案

第 39 行有语法错误,缺少 }。

应该是:

else if (salesTax<=64) {
document.write("4 cents tax." + BR);
}

关于javascript - 销售税 (JavaScript),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33284811/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com