首页 > 解决方案 > HTML - document.write

问题描述

我是 html 新手。当我单击“Lol Me”按钮时,我的以下代码网页变为空白?而不是“大声笑”。下面的代码有什么问题。

<html>
<body>
Hi there<br>

<script>
var x = "John said, \"Boy this is good\"";
var y = true;
function write(){
  document.write('LOL');
}

function funcy(){
  alert('Trozan virus');
}

</script>

<input type="button" value="press me" onclick="funcy()">
<input type="button" value="Lol me" onclick="write()">
</body>
</html>

问候, 巴努

标签: javascripthtmlbuttondocument.write

解决方案


推荐阅读