i m trying to get this to use the cordinates of two points t

i m trying to get this to use the cordinates of two points to find distance with a button,and show the distance under


<html>
<head>
<title> Distance calculater

<body>
<h2>Distance calculater</h2>
<p>
Numbers are selected between <input type=\"text\" id=\"minBox\" size=3 value=0>
and <input type=\"text\" id=\"maxBox\" size=3 value=9>.
</p>
   <script type=\"text/javascript\" src=\"../common.js\"></script>
<script type=\"text/javascript\">
function calculate() {
   var x1=parseFloat(document.getElementById(\"x1\").value);
   var y1=parseFloat(document.getElementById(\"y1\").value);
   var x2=parseFloat(document.getElementById(\"x2\").value);
   var y2=parseFloat(document.getElementById(\"y2\").value);
   var xx1=Math.pow((x2-x1),2);
   var yy1=Math.pow((y2-y1),2);
   var res=\"=sqrt((x2-x1)^2+(y2-y1)^2)\ \";
   res+=\"=sqrt((\"+x2+\"-\"+x1+\")^2+(\"+y2+\"-\"+y1+\")^2)\ \";
   res+=\"=sqrt(\"+xx1+\"+\"+yy1+\")\ \";
   res+=\"=sqrt(\"+(parseFloat(xx1)+parseFloat(yy1))+\")\ \";
   res+=\"=\"+Math.sqrt(parseFloat(xx1)+parseFloat(yy1))+\"\ \";
   res+=\"=\"+Math.round(Math.sqrt((parseFloat(xx1)+parseFloat(yy1)))*10000)/10000;
   document.getElementById(\"result1\").value=res;
}
</script>


<input type=\"button\" value=cordinate 1
onclick=\"min=parseFloat(document.getElementById(\'minBox\').value);
max=parseFloat(document.getElementById(\'maxBox\').value);
number=Math.floor(Math.random()*(max-min+1)) + min;
document.getElementById(\'outputDiv\').innerHTML=
\'\' + number;\">
input type=\"button\" value=cordinate 2
onclick=\"min=parseFloat(document.getElementById(\'minBox\').value);
max=parseFloat(document.getElementById(\'maxBox\').value);
number=Math.floor(Math.random()*(max-min+1)) + min;
document.getElementById(\'outputDiv\').innerHTML=
\'the distance between x y\' + number;\">
<hr>
<div id=\"outputDiv\"></div>
</body>
</html>

Solution

<html>
<head>
<title> Distance calculater

<body>
<h2>Distance calculater</h2>
<p>
Numbers are selected between <input type=\"text\" id=\"minBox\" size=3 value=0>
and <input type=\"text\" id=\"maxBox\" size=3 value=9>.
</p>
   <script type=\"text/javascript\" src=\"../common.js\"></script>
<script type=\"text/javascript\">
function calculate() {
   var x1=parseFloat(document.getElementById(\"x1\").value);
   var y1=parseFloat(document.getElementById(\"y1\").value);
   var x2=parseFloat(document.getElementById(\"x2\").value);
   var y2=parseFloat(document.getElementById(\"y2\").value);
   var xx1=Math.pow((x2-x1),2);
   var yy1=Math.pow((y2-y1),2);
   var res=\"=sqrt((x2-x1)^2+(y2-y1)^2)\ \";
   res+=\"=sqrt((\"+x2+\"-\"+x1+\")^2+(\"+y2+\"-\"+y1+\")^2)\ \";
   res+=\"=sqrt(\"+xx1+\"+\"+yy1+\")\ \";
   res+=\"=sqrt(\"+(parseFloat(xx1)+parseFloat(yy1))+\")\ \";
   res+=\"=\"+Math.sqrt(parseFloat(xx1)+parseFloat(yy1))+\"\ \";
   res+=\"=\"+Math.round(Math.sqrt((parseFloat(xx1)+parseFloat(yy1)))*10000)/10000;
   document.getElementById(\"result1\").value=res;
}
</script>


<input type=\"button\" value=cordinate 1
onclick=\"min=parseFloat(document.getElementById(\'minBox\').value);
max=parseFloat(document.getElementById(\'maxBox\').value);
number=Math.floor(Math.random()*(max-min+1)) + min;
document.getElementById(\'outputDiv\').innerHTML=
\'\' + number;\">
input type=\"button\" value=cordinate 2
onclick=\"min=parseFloat(document.getElementById(\'minBox\').value);
max=parseFloat(document.getElementById(\'maxBox\').value);
number=Math.floor(Math.random()*(max-min+1)) + min;
document.getElementById(\'outputDiv\').innerHTML=
\'the distance between x y\' + number;\">
<hr>
<div id=\"outputDiv\"></div>
</body>
</html>

i m trying to get this to use the cordinates of two points to find distance with a button,and show the distance under <html> <head> <title> Di
i m trying to get this to use the cordinates of two points to find distance with a button,and show the distance under <html> <head> <title> Di

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site