Skip to content

Instantly share code, notes, and snippets.

@iddar
Created October 21, 2014 01:06
Show Gist options
  • Select an option

  • Save iddar/d17fe6335494786882a5 to your computer and use it in GitHub Desktop.

Select an option

Save iddar/d17fe6335494786882a5 to your computer and use it in GitHub Desktop.
Dia 1 Curso HTML5
<!DOCTYPE html>
<html>
<head>
<title>Conociendo el DOM</title>
<style>
body{
color: red;
}
li{
color: blue;
}
#texto{
border: solid 5px #ababab;
}
ul.lista > li:hover {
background: green;
font-size: 8em;
}
</style>
</head>
<body>
<h1 class="lista">Soy una caja de titulo</h1>
<p id="texto"> Yo soy un parafo con un poco de texto.</p>
<ul>
<li>Ja! esto parece una lista</li>
<li>Justo eso es lo que soy</li>
</ul>
<ul class="lista">
<li>Ja! esto parece una lista</li>
<li>Justo eso es lo que soy</li>
</ul>
<script>
// este metodo se ejecuta cuando precionas el parrafo
var parrafo = document.getElementById("texto");
var contador = parseInt(localStorage.getItem("cont"));
parrafo.innerText = contador;
function boton (e) {
e.target.innerText = ++contador;
localStorage.setItem("cont", contador);
}
parrafo.addEventListener("click", boton, false)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment