<script> var count = 1; function run() { var div = document.createElement("div"); div.textContent = "Testing " + (count++); document.body.appendChild(div); if (count > 10) document.body.removeChild(document.body.firstChild); } setInterval(run, 1000); </script>