<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>js cambiarvalores a los atributos html</title> | |
</head> | |
<body> | |
<h2>que se puede hacer con JavaScript</h2> | |
<p>vamos a cambiar los atributos de un html</p> | |
<button type="button" onclick="document.getElementById("demo").src" apagada.jpg">apaga la luz</button> | |
<img id="demo" src="apagada.jpg" style="width: 100px;"> | |
<button type= "button"onclick="document.getElementById("demo").src="encendida.jpg">enciende la luz</button> | |
</body> | |
</html> |