Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with tax form

Status
Not open for further replies.

ameslee

Programmer
Feb 12, 2006
34
AU
i need help with this. its not working


<html><head><title>Tax</title>
<style type="text/css">
<!--
.style5 {color: #000000}
-->
</style>
</head>
<body bgcolor = "#c67777">
<h1 align=center>Tax Rates</h1></center>

<form name = "form" method = "post" action = "javascriptvoid(0)">
<input type="text" value="0" name="salary" size="20">
Salary <br><br>
<input type="text" name="tax" size="20">
Total Tax in Dollars <br><br>
<input type="text" name="gross" size="20">
Total Gross Income <br>
<br>
<input type="text" name="net" size="20">
Total Net Salary <br>
<br>
<input type="button" value="Calculate My Total" name="btnSubmit" onClick="getTotal()"> </form>

<script type = "text/VBScript">
function getTotal()
dim salary, taxRate, tax, net, gross
'input
salary = document.form.salary.value
gross = document.form.gross.value
net = document.form.net.value
tax = document.form.tax.value


if gross < 6000 then tax="0"
else if gross =<21600 then tax="0.17"
else if gross =<58000 then tax="0.30"
else if gross =<70000 then tax="0.42"
else if gross >70001 then tax="0.47"
end if




'process

tax = (salary * taxRate)
gross = (salary * 52)
net = (gross - tax)

'output
document.form.txt.value = round(Cost, 0)
document.form.txt.value = tax
end function

</script>
<span class="style5"><a href="menu.htm">Back To Main Menu </a></span>
</body></html>

 
[1] you have not leant from previous mistake.
[tt]
[red]if gross < 6000 then
tax="0"[/red]
[red]elseif[/red] gross =<21600 then tax="0.17"
[red]elseif[/red] gross =<58000 then tax="0.30"
[red]elseif[/red] gross =<70000 then tax="0.42"
[red]elseif[/red] gross >70001 then tax="0.47"
end if
[/tt]
Must be on a separate line. Why? otherwise the first if-then is complete on its own. Then "else if". If you insist on using "else if" you again has to separate in two lines for the if clause to go on. If you use the correct intended "elseif" you can keep it on the same line.

[2]
The rest you review the page design again. It is not serious even as a home work. It is a joke! (tax -> taxRate, document.form.txt..., circular...)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top