Advertisement
vencinachev

Front-end

Dec 7th, 2020
1,108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.57 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <title>Web tech</title>
  5.         <link rel="stylesheet" href="styles.css">
  6.         <script>
  7.             function randomnum(){
  8.                 var min = parseInt(document.getElementById("minnum").value);
  9.                 var max = parseInt(document.getElementById("maxnum").value);
  10.                 var result =  Math.round(Math.random() * (max - min) + min);
  11.                 alert("Random num: " + result);
  12.             }
  13.         </script>
  14.     </head>
  15.     <body>
  16.             Min: <input type="number" id="minnum"> <br>
  17.             Min: <input type="number" id="maxnum"> <br>
  18.             <button onclick="randomnum()">Random num</button>
  19.     </body>
  20. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement