Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
  <p>Hello <span>world</span></p>
  <button id="b1">Click me</button>
  <script type="text/javascript" src="s1_script_externe.js">
    <!-- en fait, jbin injecte tout seul le code tout seul JS ci-contre, mais dans un exemple réel, il y faire référence via une balise <script> -->
  </script>
</body>
</html>
 
// jshint eqeqeq:true, undef:true, devel:true, browser:true
window.addEventListener("load", function() {
  document.getElementsByTagName('span')[0]
    .addEventListener("mouseover", function() {
      console.log("haha, tickles");
    }
  );
  document.getElementById('b1')
    .addEventListener("click", function() {
      console.log("click");
    }
  );
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
pchampinpro
0viewers