Advertisement
Guest User

Untitled

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