Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- //codigo de index.html
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
- <title>Probando JavaScript</title>
- </head>
- <body>
- <h1 id="titulo">Hola a todos</h1>
- <script src="js/codigo.js"></script>
- </body>
- </html>
- */
- // accedemos al HTML DOM
- var enunciado = document.getElementById('titulo')
- // muestra el tipo de etiqueta
- alert(enunciado);
- // muestra el contenido de la etiqueta
- alert(enunciado.innerHTML);
- // modificamos u obtenemos el contenido de un elemento
- var enunciado = document.querySelector('h1')
- enunciado.innerHTML = "Nuevo contenido"
Advertisement
Add Comment
Please, Sign In to add comment