将变量的内容写入页面的最直接的方法是什么?

what is the most straightforward way of writing the content of a variable to page?

本文关键字:是什么 方法 变量      更新时间:2023-09-26

我有一个<p></p>,我想在里面放一个文本一个JS变量保存的文本,是否有可能把<script><p>,只是写在那里,不使用任何类型的DOM搜索(甚至不是innerHTML)?

<p>
<script>
var theVariable="this has some content";
document.write(theVariable);
</script>
</p>

希望这对你有帮助,也是你想要的。

演示