Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>NUBS FOR LIFE</title>
  6. <style>
  7. #outputArea {
  8. padding: .25em;
  9. border: solid black 2px;
  10. margin: 3em;
  11.  
  12. height: 20em;
  13. width: 20em;
  14.  
  15. overflow-y: scroll;
  16.  
  17. font-family: consolas, 'courier new', monospace;
  18. font-size: 1em;
  19. color: rgb(50, 50, 250);
  20.  
  21. background-color: rgb(225,225,225) ;
  22. }
  23. </style>
  24.  
  25. </head>
  26.  
  27. <body>
  28. <div id="outputArea">
  29. <p> Radius:
  30. <label id="RadiusOutput"></label>
  31. , ratio:
  32. <label id="RatioOutput"></label> </p>
  33. </div>
  34.  
  35. <script>
  36. // PASTE YOUR CODE HERE
  37.  
  38. var radius=1, area, circum, ratio=0;;
  39. var radiusRef = document.getElementById("RadiusOutput");
  40. var ratioRef = document.getElementById("RatioOutput");
  41. var radiusOutput = "", ratioOutput = "";
  42.  
  43. var newRatioLabel = document.createElement("Label");
  44.  
  45.  
  46. while (ratio<30)
  47. {
  48. circum = 2 * Math.PI * radius;
  49. area = Math.PI * (radius * radius);
  50. ratio = area/circum;
  51. radiusOutput = radius;
  52. ratioOutput = ratio + "<br/>"
  53.  
  54. // NEED TO DYNAMICALLY ADD TWO NEW LABELS HERE SO THAT MY RADIUS AND RATIO WILL BE PRINTED ON THE FOLLOWING LINE AS PER LOOP
  55. var newLabel = document.createElement("label");
  56. newLabel.appendChild("")
  57.  
  58.  
  59. radius = radius + 1;
  60. }
  61.  
  62. radiusRef.innerHTML = radiusOutput;
  63. ratioRfef.innerHTML = ratioOutput;
  64.  
  65.  
  66. </script>
  67. </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement