Know the coordinates of the two-point computer out of their distance

Source: Internet
Author: User
Tags eval xdiff
Tip: You can modify some of the code before running

<ptml> <pead> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <title> knows two points of the coordinates of the computer out of their distance </title> </pead> <body> <script language=" JavaScript > <!--Begin function distance (form) {var x1 = eval (form.x1.value); var y1 = eval (form.y1.value); var x2 = eval (form.x2.value); var y2 = eval (form.y2.value); var xdiff = x2-x1; var ydiff = y2-y1; Form.answer.value = Math.pow (Xdiff * xdiff + Ydiff * ydiff), 0.5); }//End--> </script> <center> <form> <table border=3 cellspacing=2 cellpadding=5> <tr> &LT;TD colspan=4 align=center> compute the distance between plane two points </td> </tr> <tr> <td colspan=2 align=center>a Point </td> <td colspan=2 align=center>b point </td> </tr> <tr> <td align=center>a Point Horizontal axis </td > <td align=center>a Point ordinate </td> <td align=center>b Point horizontal axis </td> <td align=center>b Point ordinate </td> </tr> <tr> <td align=Center><input type=text name=x1 size=5></td> <td align=center><input type=text name=y1 size=5 ></td> <td align=center><input type=text name=x2 size=5></td> <td align=center>< Input Type=text name=y2 size=5></td> </tr> <tr> <td colspan=4 align=center><input type= Button value= "Calculate Distance" onclick= "distance (this.form)" ></td> </tr> <tr> <td colspan=4 align=center ><input type=text name=answer size=20></td> </tr> </table> </form> </center> </body> </ptml>
Tip: You can modify some of the code before running
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.