Why does my browser still show the loading icon after I clicked the button?
jsfiddle.net/QuwUF/1
<script type="text/javascript">
f开发者_如何学编程unction 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 call document.close()
so it never finishes "loading".
精彩评论