手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >document.open() 与 document.write()
document.open() 与 document.write()
摘要:document.open()打开一个新的空白文档,在IE下,open有两个默认参数,相当于document.open("text/html...

document.open()打开一个新的空白文档,在IE下,open有两个默认参数,相当于document.open("text/html",'""),第二个参数只有一个值可选:replace,如果启用了该值,则新建的文档会覆盖当前页面的文档(相当于清空了原文档里的所有元素,且不能后退即,浏览器的后退按钮不可用);

看一个例子:

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

平常都不写document.open()与document.close(),因为浏览器会在write之前先open一个文档,再把write的内容输出到原文档里面。write结束后,默认是不会有close的,否则第二行document.write的时候就会覆盖之前的write。

【document.open() 与 document.write()】相关文章:

JavaScript实现身份证验证代码

Eclipse编辑jsp、js文件时卡死现象的解决办法汇总

下拉菜单

JavaScript获取当前运行脚本文件所在目录的方法

JavaScript中的Math.SQRT1_2属性使用简介

常用DOM整理

微信WeixinJSBridge API使用实例

document 和 document.all 分别什么时候用

mouse_on_title.js

jquery中添加属性和删除属性

精品推荐
分类导航