I have been attempting to figure out how to create a distance calculator. I think the formula is correct, but my issue is that my variables will not run through the formula or even display in my output.
<!doctype html>
<!-- distance.html Mason Boroff -->
<!-- =================================================== -->
<html>
<head>
<title> Distance Calculator </title>
<script type="text/javascript">
function ShowDistance()
{
var x1, x2, y1, y2;
x1=parsefloat(document.getElementById('xOne').value);
x2=parsefloat(document.getElementById('xTwo').value);
y1=parsefloat(document.getElementById('yOne').value);
y2=parsefloat(document.getElementById('yTwo').value);
var distance = Math.sqrt( Math.pow((x1-x2), 2) + Math.pow((y1-
y2), 2) );
return distance;
document.getElementById('outPut').innerHTML=
'The distance bewtween (' + x1 + ',' + y1 + ') and ('
+ x2 + ',' + y2 + ') is '+ distance +;
}
</script>
</head>
<body>
<h2>Distance Calculator</h2>
<p>
Coordinate 1: (<input type="text" id="xOne" size=12 value=''> ,
<input type="text" id="yOne" size=12 value=''>)
<br>
Coordinate 2: (<input type="text" id="xTwo" size=12 value=''> ,
<input type="text" id="yTwo" size=12 value=''>)
<br>
<br>
<input type="button" onclick="ShowDistance()" value="Calculate
Distance";>
</p>
<hr>
<div id="outPut"> </div>
</body>
document.getElementById('outPut').innerHTML=will never execute, run it infront of the return.parseFloat...parseFloatand+afterdistancewhile setting innerHTML