Advertisement
Guest User

Untitled

a guest
May 24th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body style="background-color: #000;"> <div align="center" id="tools_lcalc">
  4. <h3 style="color: #fff;">
  5. <b><u>Hypotenuse Resolver</u></b>
  6. </h3>
  7.  
  8. <h4 align="center" style="color:#fff;">
  9. <font size="2px">This is the hypotenuse calculator, enter side length 1 in one of the text boxes, and side length 2 in the other.
  10. <br style="width:1px; height: 2px;">Then click "Get Hypotenuse", to get the hypothenuse. Please note the number you get is already squared. </font>
  11. </h4>
  12. <div align="center" id="tools_hcalc">
  13. <textarea onfocus="clear1(this)" id="num1" rows="1" cols="35" style="width:100px; background-color: #000; color: #fff; text-align: center;">
  14. Leg 1
  15. </textarea>
  16. <textarea onfocus="clear2(this)" id="num2" rows="1" cols="35" style="width:100px; background-color: #000; color: #fff; text-align: center;">
  17. Leg 2
  18. </textarea>
  19. </div>
  20. <div align="center">
  21. <button onclick="cal()" id="submit" align="center" style="color: #fff; background-color: #000; width=70px; height:27px;"> Get Hypotenuse </button>
  22. </div>
  23. <br>
  24. <hr style="background-color: 2px; border-style: solid; border-color: #fff; border-width: 4px;">
  25. <br>
  26. <div align="center" id="tools_lcalc">
  27. <h3 style="color: #fff;">
  28. <b><u>Leg Resolver</u></b>
  29. </h3>
  30. <h4 align="center" style="color:#fff;">
  31. <font size="2px">This is the leg resolver, enter the length of one of the legs in the text box that says "Leg", and enter the hypotenuse inside the box that says "Hypotenuse".<br style="width:1px; height: 2px;">Then click "Get Leg", to get the leg.</font>
  32. </h4>
  33. <textarea onfocus="clear1(this)" id="hypo" rows="1" cols="35" style="width:100px; background-color: #000; color: #fff; text-align: center;">
  34. Hypotenuse
  35. </textarea>
  36. <textarea onfocus="clear2(this)" id="leg" rows="1" cols="35" style="width:100px; background-color: #000; color: #fff; text-align: center;">
  37. Leg
  38. </textarea>
  39. </div>
  40. <div align="center">
  41. <button onclick="resleg()" id="gleg" align="center" style="color: #fff; background-color: #000; width=70px; height:27px;"> Get Leg </button>
  42. </div>
  43. <script id="calculation">
  44. function cal() {
  45. var ogf = document.getElementById("num1").value;
  46. var ogs = document.getElementById("num2").value;
  47.  
  48. var df = ogf * ogf;
  49. var ds = ogs * ogs;
  50.  
  51. var ans = df + ds;
  52. var anst = Math.sqrt(ans);
  53.  
  54. alert(anst);
  55. }
  56.  
  57. function clear1(element) {
  58. element.value = ''
  59. }
  60. function clear2(element) {
  61. element.value = ''
  62. }
  63. </script>
  64. <script>
  65. function resleg() {
  66. var ogh = document.getElementById("hypo").value;
  67. var ogl = document.getElementById("leg").value;
  68.  
  69. var ans_0 = ogh * ogh;
  70. var ans_1 = ogl * ogl;
  71. var ans_2 = ans_0 - ans_1;
  72. var ans_3 = Math.sqrt(ans_2);
  73.  
  74. alert(ans_3);
  75. }
  76.  
  77. </script>
  78.  
  79. </body>
  80. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement