Created
April 21, 2018 16:58
-
-
Save jreyes/402381766754a3a32d3407d353de082a to your computer and use it in GitHub Desktop.
Documento sin título // source https://jsbin.com/murafifife
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Documento sin título</title> | |
</head> | |
<body> | |
<p><img src="http://media.comicbook.com/2018/03/vegeta4-1092189.jpeg"></p> | |
<script> | |
function aviso1() { | |
alert("hola soy la imagen"); | |
} | |
function aviso2() { | |
alert("Hola soy el parrafo"); | |
} | |
function loseventos() { | |
document.getElementsByTagName('p')[0].onclick = aviso1; | |
document.getElementsByTagName('img')[0].onclick = aviso2; | |
} | |
window.addEventListener("DOMContentLoaded", loseventos, false); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Documento sin título</title> | |
</head> | |
<body> | |
<p><img src="http://media.comicbook.com/2018/03/vegeta4-1092189.jpeg"></p> | |
<script> | |
function aviso1() { | |
alert("hola soy la imagen"); | |
} | |
function aviso2() { | |
alert("Hola soy el parrafo"); | |
} | |
function loseventos() { | |
document.getElementsByTagName('p')[0].onclick = aviso1; | |
document.getElementsByTagName('img')[0].onclick = aviso2; | |
} | |
window.addEventListener("DOMContentLoaded", loseventos, false); | |
<\/script> | |
</body> | |
</html> | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment