Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pt-br">
- <head>
- <meta charset="UTF-8" >
- <title>Exer 2</title>
- </head>
- <body>
- <button>Gerar</button>
- <h2></h2>
- <script>
- document.querySelector("button").onclick = gerar;
- function gerar() {
- var r = Math.floor(Math.random() * 50);
- document.querySelector("h2").innerHTML = r;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement