Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<head>
    <title>Javascript Tests</title>
    <script type="text/javascript">
      window.onload = function() {
        var mySpan = document.createElement("span");
        mySpan.innerHTML = "This is my span!";
        mySpan.style.color = "red";
        document.body.appendChild(mySpan);
        alert("Why does the span change after this alert? Not before?");
      }
    </script>
</head>
<body>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers