ivapopova

to_debug.html

Oct 26th, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.61 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>to_debug</title>
  6. </head>
  7. <body>
  8. <label>Enter a number [1..10]:<input type="number" name="userInput"></label>
  9. <button class="test">Test for even</button>
  10. <div class="output"></div>
  11. <script type="text/javascript">
  12.     let userInput = document.querySelector('input[type="number"]');
  13.     let output = document.querySelector('.output');
  14.     let btnTest = document.querySelector('.test');
  15.  
  16.  
  17.     btnTest.addEventListener("click", function(){
  18.         x = userInput.vаlue*1;
  19.         output.innerHTML = (x % 2) &&  "ODD" || "EVEN";
  20.     },false)
  21.  
  22. </script>
  23. </body>
  24. </html>
Advertisement
Add Comment
Please, Sign In to add comment