| <html> | |
| <head> | |
| <title>Javascript</title> | |
| </head> | |
| <body> | |
| <p id="text">Hello World!</p> | |
| <button id="myButton">Change text</button> | |
| <p id="secondParagraph">Javascript is ... </p> | |
| <button id="secondButton">Append text</button> | |
| <p id="emptyParagraph"></p> | |
| <button id="createParagraph">Create text</button> | |
| <script type="text/javascript"> | |
| document.getElementById("myButton").onclick = function() { | |
| document.getElementById("text").innerHTML = "Hello Rob!"; | |
| } | |
| document.getElementById("secondButton").onclick = function() { | |
| document.getElementById("secondParagraph").innerHTML = "I think " + document.getElementById("secondParagraph").innerHTML + "awesome!"; | |
| } | |
| document.getElementById("createParagraph").onclick = function() { | |
| document.getElementById("emptyParagraph").innerHTML = "<h1>Hi there!</h1>"; | |
| } | |
| </script> | |
| </body> | |
| </html> |
miércoles, 23 de noviembre de 2016
Cambiando contenido html
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario