<head> <title> If Demo Page </title> <script type="text/javascript"> function ShowMessage() // Assumes: document.IfForm.gradeBox contains a grade // Results: displays a warning in response to a failing grade { var grade;
grade = document.IfForm.gradeBox.value; grade = parseFloat(grade);
if (grade < 60) { alert("You failed! Time to hit the books."); } } </script> </head>
<body> <form name="IfForm"> Your grade: <input type="text" name="gradeBox" size=10 value="" /> <br /><br /> <input type="button" value="Click for Message" onClick="ShowMessage();" /> </form> </body> </html>
|