[Solved] beginner trying to apply a tax rate to an individual’s income


I wonder how much of that was a template. Oh by the way, have faith in yourself. I don’t know how much of that you wrote yourself, but for the function itself, only the IncomeInput<=20000 comparator needed to be switched.

<html>
<head>
</head>


<body>

<script>

function calcTax() {

    var IncomeInput, TaxRateCalc;

    IncomeInput = parseInt(document.TaxInfo.Income.value);

    if (IncomeInput>=70000)
    {
        TaxRateCalc = "70";
    }
    else if (IncomeInput<=20000)
    {
        TaxRateCalc = "10";
    }
    else
    {
        TaxRateCalc = "25"; 
    }
    document.YourTaxRate.TaxRate.value = TaxRateCalc;

}

</script>

<center>
The Taxman
</center>


<form name = "TaxInfo">
    <table border = "3">
        Your Tax Information<br>
        <tr><td>Income</td> <td> <input name = "Income" value = "10000000" size = "20"> </td> </tr>
        <tr><td>RRSP</td> <td> <input name = "RRSP" value ="0" size = "20"></td> </tr>
        <tr><td>Tax Rate</td> <td> <input name = "TaxRate" value = "" size = "20"> </td> </tr>
        <tr><td>Taxes Paid</td> <td> <input name = "TaxesPaid" value = "0" size = "20"> </td> </tr>
        <tr><td>Refund or Due</td> <td> <input name = "RefundOrDue"  value = "0"size = "20"> </td> </tr> 
    </table>
</form>

<form name = "Extra Deductions">
    Extra Deductions-
    Children <input name = "Children" type = "radio">
    Spouse <input name = "Spouse" type = "radio">
    Both <input name = "Both" type = "radio">
    None <input name = "None" checked type = "radio">
</form>

<form name = "OldPeople" >
    Over age 65? <input name = "Over age 65?" type = "checkbox" >
</form>

<form name = "Selection">
    Special Cases
    <select name="SpecialCases">

        <option value ="None"> None </option>
        <option value ="Hardship Claimed"> Hardship Claimed </option>
        <option value ="Mercy"> Mercy </option>
        <option value ="Lawyer"> Lawyer </option>
    </select>
</form>

<form name = "buttons">
    <input type = "button" value = "Calculate your tax!" onclick = "calcTax()" />
    <input type = "button" value = "Clear Display Area" onclick = "" />
</form>

<form name = "YourTaxRate">
    Your Tax Rate<br> <textarea name = "TaxRate" rows = "15" cols = "25"> </textarea>
</form>

</body>
</html>

4

solved beginner trying to apply a tax rate to an individual’s income