Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!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>
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers