Last active
June 12, 2020 13:28
-
-
Save agustinpfs/98ac20b09dd58fe2d3a29737e0f99c30 to your computer and use it in GitHub Desktop.
Javascript básico. DOM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Document.getElementById(”valor del atributo id”) devuelve el | |
elemento que tiene el atributo ID con el valor especificado. --> | |
<!-- <html> | |
<body> | |
<p id="nombreId">GetElementById</p> | |
<script> | |
let elemento = document.getElementById("nombreId") | |
</script> | |
</body> --> | |
<!-- ver let elemento en devtools --> | |
<!-- Document.write() escribe un texto en el documento HTML --> | |
<!-- <script> | |
document.write("Hola Mundo!"); // Hola Mundo! (en el navegador) | |
</script> --> | |
<!-- Element.innerHTML inserta contenido en el elemento indicado --> | |
<!-- <html> | |
<body> | |
<p id="nombreId"></p> | |
<script> | |
let saludo = "Hola Mundo"; | |
let elemento = document.getElementById("nombreId").innerHTML = saludo; | |
</script> | |
</body> | |
</html> --> | |
<html> | |
<body> | |
<h1 id="saludo">Hola mundo</h1> | |
<script> | |
document.getElementById("saludo").style.color = "blue"; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment