Advertisement
ph4x35ccb

pegando dados do imput

May 8th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Curso JavaScript</title>
  5.    
  6. </head>
  7. <body>
  8. <h1>Curso javascript</h1>
  9. <input type="text" id="txtNome" value="Nome">
  10. <button onclick="escreve()">Enviar</button>
  11. <div id="msg"></div>
  12. <script>
  13.     function escreve(){
  14.         txtNome2 = document.querySelector("#txtNome");
  15.         var nome = txtNome2.value;
  16.         document.querySelector('#msg').innerHTML="Bem vindo <b>"+nome+"<br>";
  17.    };
  18. </script>
  19. </body>
  20. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement