我正在嘗試使用Javascript製作年薪計算器。以下是我迄今爲止:Javascript工資計算器
<div id="fulldiv">
\t \t <p> Enter the following information to calculate your annual salary.</p>
\t \t \t \t \t
\t \t <p>Hourly Wage:
\t \t <input type="text" name="wage" id="txt_wage" value ="0.00"/></p>
\t \t \t \t \t
\t \t <p>Hours Per Week:
\t \t <input type="text" name="hours" id="txt_hours" value= "0.0"/> <br/><br/>
\t \t
\t \t <button value="calculate" onclick="calcSalary()">Calculate</button></p>
\t \t
\t \t <p id="results"></p>
\t \t \t \t \t
\t \t <script type="text/javascript">
\t \t
\t \t function calcSalary() {
\t \t var wage_element = document.getElementById('txt_wage');
\t \t var wage = parseInt(wage_element.value);
\t \t var hours_element = document.getElementById('txt_hours');
\t \t var hours = parseInt(hours_element.value);
\t \t var calculate = wage_element * hours_element * 52;
\t \t document.getElementByID('results').innerHTML = calculate;
\t \t }
\t \t </script>
\t \t \t \t
\t \t \t \t \t
\t \t \t \t
</div>
當我按一下按鈕,沒有任何反應。有什麼想法嗎?
**的Java(不要使用JavaScript或JScript混淆)** – chrylis