45
rated 0 times
[
46]
[
1]
/ answers: 1 / hits: 15852
/ 7 Years ago, thu, april 6, 2017, 12:00:00
I am trying to make an annual salary calculator using Javascript. Here is what I have so far:
<div id=fulldiv>
<p> Enter the following information to calculate your annual salary.</p>
<p>Hourly Wage:
<input type=text name=wage id=txt_wage value =0.00/></p>
<p>Hours Per Week:
<input type=text name=hours id=txt_hours value= 0.0/> <br/><br/>
<button value=calculate onclick=calcSalary()>Calculate</button></p>
<p id=results></p>
<script type=text/javascript>
function calcSalary() {
var wage_element = document.getElementById('txt_wage');
var wage = parseInt(wage_element.value);
var hours_element = document.getElementById('txt_hours');
var hours = parseInt(hours_element.value);
var calculate = wage_element * hours_element * 52;
document.getElementByID('results').innerHTML = calculate;
}
</script>
</div>
When I click the button, nothing happens. Any thoughts?
More From » javascript