Why does my browser still show the loading icon after I clicked the button?
jsfiddle.net/QuwUF/1
<script type="text/javascript">
function printName(name){
var message= document.write("hi " + name);
return message;
}
</script>
<form>
<input type="button" onclick='printName("scotty")' />
</form>
You (implicitly — by calling
document.write()on a closed document) open a new document, but after you write to it, you never calldocument.close()so it never finishes “loading”.