Advertisement
Guest User

Ibasi testa

a guest
Dec 5th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.     <body>
  4.         <p>calculate the Body Mass Index! (BMI)</p>
  5.  
  6.         <button>Try it</button>
  7.         <pre style="display: none"></pre>
  8.         <div id="comment"></div>
  9.         <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
  10.         <script>
  11.             (function () {
  12.                 $('button').click(function () {
  13.                     var weight = prompt('Please enter your weight', 'here'),
  14.                             height = prompt("Please enter your height", "Here");
  15.                     if (height == "inches")
  16.                         height /= 39.3700787;
  17.                     if (weight == "lb")
  18.                         weight /= 2.20462;
  19.                     var BMI = weight * 703 / Math.pow(height, 2);
  20.                     $('pre').show().html(Math.round(BMI * 100) / 100);
  21.                     if (BMI < 18.5)
  22.                         $('#comment').html('Ti si basi iglata brat. Trqq idish na psiholog.');
  23.                     if (BMI >= 18.5 && output <= 25)
  24.                         $('#comment').html('Sichko e tok i jica.');
  25.                     if (BMI > 30)
  26.                         $('#comment').html('Svincho si ti i trqq spresh torite na obed. I VYRVI DA TRENIRASH SHOPAR CHE IDI KOLEDA.');
  27.                     alert("Tvoq BMI e: " + BMI + "! Debel li sa chuvstvash kaval");
  28.                 });
  29.             })();
  30.         </script>
  31.     </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement