Question #37731

At the State Fair Pie Eating Contest all contestants in the heavyweight division must weigh within 130 pounds to 250 pounds. Write a program that asks for a contestant's weight and then says if the contestant is allowed in the contest.
1

Expert's answer

2013-12-10T11:50:17-0500

Answer on Question #37731, Programming, AJAX

Below is the code for simple html page with script you have asked. The actual code is between `<script></script>` tags we have marked it bold. We have binded the function to `document.onload` event, you are free to change event to any other.


<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <script>
    window.onload = function() {
        var weight = prompt('Enter your weight in pounds, please', 100);
        if (weight >= 130 && weight <= 250) {
            alert('You are allowed in the contest');
        }
        else {
            alert('You are NOT allowed in the contest');
        }
    }
    </script>
</head>
<body>
    <div>TODO write content</div>
</body>
</html>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS