Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <p>calculate the Body Mass Index! (BMI)</p>
- <button>Try it</button>
- <pre style="display: none"></pre>
- <div id="comment"></div>
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
- <script>
- (function () {
- $('button').click(function () {
- var weight = prompt('Please enter your weight', 'here'),
- height = prompt("Please enter your height", "Here");
- if (height == "inches")
- height /= 39.3700787;
- if (weight == "lb")
- weight /= 2.20462;
- var BMI = weight * 703 / Math.pow(height, 2);
- $('pre').show().html(Math.round(BMI * 100) / 100);
- if (BMI < 18.5)
- $('#comment').html('Ti si basi iglata brat. Trqq idish na psiholog.');
- if (BMI >= 18.5 && output <= 25)
- $('#comment').html('Sichko e tok i jica.');
- if (BMI > 30)
- $('#comment').html('Svincho si ti i trqq spresh torite na obed. I VYRVI DA TRENIRASH SHOPAR CHE IDI KOLEDA.');
- alert("Tvoq BMI e: " + BMI + "! Debel li sa chuvstvash kaval");
- });
- })();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement