Tests input for equality (==) with the number 9.
<head> <title>if syntax</title> <script> function checkValue(){ var val = document.getElementById("num").value; if (val == 9) alert("the number entered is 9"); } </script> </head> <body> <h3>Simple conditional</h3> <p>Tests input for equality (==) with the number 9.</p> <form onSubmit="checkValue();"> <input type="text" id="num"> Enter a number, script checks for 9<br> <input type="submit"> </form> </body>