<html>
<body>
<script type="text/javascript">
document.write("Hello World!")
</script>
</body>
</html>
document.write 字段是标准的 JavaScript 命令,用来向页面写入输出。
如果我们不使用 <script> 标签,浏览器就会把 document.write("Hello World!") 当作纯文本来处理,也就是说会把这条命令本身写到页面上。
本文详细介绍了JavaScript中的document.write()函数的使用方法,展示了如何通过该函数快速向HTML页面输出文本内容。同时,文章解释了在不使用<script>标签的情况下,document.write()命令被当作纯文本处理的现象,以及这种行为带来的影响。
<html>
<body>
<script type="text/javascript">
document.write("Hello World!")
</script>
</body>
</html>
document.write 字段是标准的 JavaScript 命令,用来向页面写入输出。
如果我们不使用 <script> 标签,浏览器就会把 document.write("Hello World!") 当作纯文本来处理,也就是说会把这条命令本身写到页面上。
2101
3251

被折叠的 条评论
为什么被折叠?