- JavaScript DHTML
- Language Basics
- If
Testing value in range
<html> <head> <title>Testing value in range</title> <script type="text/javascript"> var nValue = 0; if (nValue >= 0 && nValue <= 100) { alert("value between 0 and 100, inclusive"); } elseif (nValue > 0 && nValue < 100) { alert("value between 0 and 100 exclusive"); } elseif (nValue > 100) { alert ("value over 100"); } elseif (nValue > 0) { alert ("value is negative"); } </script> </head> <body> </body> </html>
Related examples in the same category