<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html id=body>
<head>
<title> New Document </title>
</head><body onload="aaa()">
<script language="JavaScript">
function aaa(){
document.open("text/html","replace")
document.write("<html><head><title>New File</title></head>")
document.write("<body>This is a new file</body></html>")
}
</script>
</body></html>
<html id=body>
<head>
<title> New Document </title>
</head><body onload="aaa()">
<script language="JavaScript">
function aaa(){
document.open("text/html","replace")
document.write("<html><head><title>New File</title></head>")
document.write("<body>This is a new file</body></html>")
}
</script>
</body></html>
解决方案 »
- 路过就不要错过
- IE、火狐兼容问题!
- 如何恢复左键右键功能
- 如何实现Object.prototype.show()的功能
- 在线求教javascript小问题!!??
- 怎么在使用javascript使按钮的 disabled(在可以点与不可以点) 切换。(怎么表达呢??:()进里面看看
- 在java中s1.endsWith(s2),在javascript中怎么写?
- 急切求助! javascript调用当前页面的url和title
- 哪个高手来帮我一下???做个播放器。。
- JQUERY的代码与JS互换问题
- 如何捕获键盘事件?
- 如何使用LAYER?或者在网页中如何实现类似java中JTabbedPane的分页显示的控件?
<head>
<title> New Document </title>
<script language=javascript>
function cc(aa)
{
document.body.innerHTML = aa;
}
</script>
</head><body ondblclick="alert('网页的内容:\r\n'+document.body.innerHTML)">
<input type=text name=txt>请在此文本框里输入新网页的内容<br>
<input type=button value=ok onclick="cc(document.all.txt.value)">
在网页空白处双击可以弹出当前页面里的内容!
</body>
</html>
下面这个更彻底::document.all.tags('html')[0].innerHTML='your html text'连head都可以换掉
这个够狠这个也狠:
document.open("text/html", "replace")
document.write(
"<html><head>...</head>"
+"<body>...</body>"
+"<html>"
);
document.close()