Help with HTML/ Javascript total sales calculator?

for some reason my calculator isnt working and i dont know why i was hoping someone could help me.

<html>
<head>
<style> body {background-color:yellow}
</style>
<title>Paralax Motors Corps. </title>
</head>
<body>
<h1> Paralax Motors Corps. </h1>
<br>
<h2> Sales ($ Millions) </h2>
<br>
<!-- note to self use tag p instead of double br to break up lines -->

Eastern Division<input type="text" id="Eastern" onchange=''>
<br><br>
Western Division<input type="text" id="Western" onchange=''>
<br><br>
<button id="Total Sales" onclick='
var total_2017 = Number(Eastern.value) + Number(Western.value); sales2017.value = total_2017;'>Calculate Total</button>

<br><br>
2017 Total Sales<input type="text" id="sales2017" onchange=''>
<br><br>
Estimate for 2018
<input type="radio" name="estimate" id="high" onclick='var high_increase=0.30;
var high_sales = sales2017.value*(1+high_increase) ; 2018sale.value = high_sales;'>high
<input type="radio" name="estimate" id="low" onclick='
var low_increase=0.10 ;
var low_sales = sales2017.value*(1+low_increase) ; 2018sale.value= low_sales ; '>low
<br><br>
2018 Expected Sales<input type="text" id="2018sale" onchange=''>

</body>
</html>

Anonymous2018-03-02T02:29:35Z

Favorite Answer

try this... only needs to change 3 lines.

Eastern Division<input type="text" id="Eastern">
Western Division<input type="text" id="Western">
<button id="Total Sales" onclick='sales2017.value = Number(Eastern.value) + Number(Western.value)'>Calculate Total</button>
2017 Total Sales<input type="text" id="sales2017">
Estimate for 2018
<input type="radio" name="estimate" id="high" onclick='2018sales.value = Number(sales2017.value) * (1.3)'>high
<input type="radio" name="estimate" id="low" onclick='2018sales.value = Number(sales2017.value) * (1.1)'>low
2018 Expected Sales<input type="text" id="2018sales">

Chris2018-03-01T18:37:53Z

You can't use 2018sales as identifier in JS code. Variables cannot start with numeric characters.

Fixed: https://jsfiddle.net/og7ewmof/