简体   繁体   English

单击按钮后,为什么浏览器仍显示加载图标?

[英]Why does my browser still show the loading icon after I clicked the button?

Why does my browser still show the loading icon after I clicked the button? 单击按钮后,为什么浏览器仍显示加载图标?

jsfiddle.net/QuwUF/1 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>

您(隐式地-通过在已关闭的文档上调用document.write() )打开了一个新文档,但是在写入新文档之后,您再也不会调用document.close()因此它永远不会完成“加载”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM