document.write()

document.write()

CreateTime--2018年3月1日17:43:16

Author:Marydon

用途:在指定位置末尾输出内容

用法:

  1.输出文本;

  2.输出HTML标签;

  3.可以携带多个参数。

缺点:会将原文中的内容覆盖掉 

演示

代码展示

界面展示

如何避免覆盖原文内容呢?

  在要展示的位置输出

<body>
    演示document.write()
    <script type="text/javascript">
        document.write("插入文本","<p>插入HTML标签<p>","write()函数可以携带多个参数");
    </script>
</body>
原文地址:https://www.cnblogs.com/Marydon20170307/p/8489874.html