Advertisement
StefiIOE

vezba

Feb 7th, 2020
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. </head>
  5. <body>
  6. <p>Please input a number between 1 and 10:</p>
  7. <input id="numb" type="text">
  8. <button type="button" onclick="myFunction()">Submit</button>
  9. <p id="demo"></p>
  10. <script>
  11.   function myFunction() {
  12.     var x , text;
  13.     x=document.getElementById("numb").value;
  14.     if(isNaN(x) || x < 10 || x > 10)
  15.     {
  16.       text = "Input not valid";
  17.     }
  18.     else
  19.       {
  20.         text = "Input okey"
  21.       }
  22.     document.getElementById("demo").innerHTML=text;
  23.   }
  24.  
  25. </script>
  26. </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement