i am trying to get this library file incomejs using this to
i am trying to get this library file income.js using this, to be loaded with the tazes.html and use the incometzs function to calculate and display the income tax,
}
*^js code***\\/ html code*
| <script type=\"text/javascript\"> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function Icometace(income, itemized) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assynes: income .=0, itemzed .=0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Returns: flat tax (13%) due after deductions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var deduction, taxableIcome, total tax; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deduciton= Math.max(itermized, 4150): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| taxableIncome = Math.max(income - debuction, o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| toatltax = 0.13*tableTincome | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return totaltax; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } *^js code***\\/ html code*
|
Solution
hey heres the code, if you have any doubts or problems post comments.
Taxes.html
<html>
<head>
<script>
function itemized(x,val)
{
Incometax(x,val);
}
function Incometax(x,val)
{
var deduction, taxableIncome, totaltax,income;
deduction= Math.max(x, 4150);
income=val;
taxableIncome = Math.max(income - deduction, 0);
totaltax = 0.13*taxableIncome;
document.getElementById(\"outputDiv\").innerHTML = totaltax;
}
</script>
</head>
<body>
<div style=\"text-align:center\">
<h2>taxes</h2>
<p>
click to compute
</p>
<input type=\"button\" value=\'100000.00\' onclick=\"itemized(12017.50,this.value)\">
<input type=\"button\" value=\'42500.00\' onclick=\"itemized(8900.99,this.value)\">
<input type=\"button\" value=\'13267.45\' onclick=\"itemized(14000.00,this.value)\">
<div id=\'outputDiv\'></div>
</div>
</body>
</html>


