2-5 使用document.write来将内容输出到页面.htm

来自「JAVASCRIPT完全自学手册,中源码的验证修订实例」· HTM 代码 · 共 15 行

HTM
15
字号
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312" />
<title>2-5  使用document.write来将内容输出到页面</title>
<!-- 脚本部分 -->
<script type="text/javascript">
    document.write("你好");
    document.write("<br><b>可以输出HTML</b>");
</script>
</head>
<body style="overflow:auto;">
    <input type="button" value="点我"
        onclick="document.write('在页面加载完成后再次使用document.write会清空原来的所有内容');" />
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?