TOP JavaScript HTML
<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Compute</title> <script type="text/javascript"> <!-- function compute_distance() { var x1 = parseFloat(document.F1.X1.value); var y1 = parseFloat(document.F1.Y1.value); var x2 = parseFloat(document.F1.X2.value); var y2 = parseFloat(document.F1.Y2.value); document.F1.D.value = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); } // --> </script> <link rel="stylesheet" type="text/css" href="http://img.shinobi.jp/tadaima/tdftad.css" /></head> <body> <form name="F1" action="#"> (x1,y2)=(<input type="text" name="X1">,<input type="text" name="Y1">)<br /> (x2,y2)=(<input type="text" name="X2">,<input type="text" name="Y2">)<br /> <input type="button" value="Distance" onclick="compute_distance()"> <input type="text" name="D"> </form> </body> </html>
最新コメント