teslariu

documentById

Jul 20th, 2022
1,109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Ejemplo</title>
  8. </head>
  9. <body>
  10.     <p id="demo">Contenido a modificar</p>
  11.    
  12.     <button type="button" onclick="document.getElementById('demo').innerHTML = 'Contenido modificado'">
  13.         Cambio de contenido
  14.     </button>
  15.      
  16.     <button type="button" onclick="document.getElementById('demo').style.backgroundColor = 'green'">
  17.         Cambio de estilo
  18.     </button>
  19.  
  20.     <button type="button" onclick="document.getElementById('demo').style.display = 'none'">
  21.         Ocultar el contenido
  22.     </button>
  23.  
  24.     <button type="button" onclick="document.getElementById('demo').style.display = 'block'">
  25.         Mostrar el contenido
  26.     </button>
  27.    
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment