<HTML>
<HEAD>
<Title>Write to subwindow.</Title>
<Script language="JavaScript">
var newWindow
function makeNewWindow()
{
newWindow=window.open("","","status,height='200',width='300'");
}
function subWrite()
{
if(newWindow.closed){ makeNewWindow;
var newContent="<HTML><HEAD><Title>A new doc.</Title><HEAD>";
newContent+="<Body BGCOLOR='coral'><H1>This document is brand new.</h1>";
newContent+="Click the back button to see original document.";
newContent+="</Body></HTML>";
newWindow.document.write(newContent);
newWindow.documemt.close();
}
}
</Script>
</HEAD>
<body onLoad="makeNewWindow()">
<Form>
<input type="button" value="Write to Subwindow" onClick="subWrite()">
</Form>
</body>
</HTML>
<HEAD>
<Title>Write to subwindow.</Title>
<Script language="JavaScript">
var newWindow
function makeNewWindow()
{
newWindow=window.open("","","status,height='200',width='300'");
}
function subWrite()
{
if(newWindow.closed){ makeNewWindow;
var newContent="<HTML><HEAD><Title>A new doc.</Title><HEAD>";
newContent+="<Body BGCOLOR='coral'><H1>This document is brand new.</h1>";
newContent+="Click the back button to see original document.";
newContent+="</Body></HTML>";
newWindow.document.write(newContent);
newWindow.documemt.close();
}
}
</Script>
</HEAD>
<body onLoad="makeNewWindow()">
<Form>
<input type="button" value="Write to Subwindow" onClick="subWrite()">
</Form>
</body>
</HTML>
解决方案 »
- 不间断向上滚动代码无效问题
- web前端 jquery javascript页面移动问题
- js中如何弹出个文本框
- 怎样在asp.net treeview控件的节点处实现 edit in place?
- Jquery如何选择现在mouseover的div的子元素
- onbeforepaste 疑问??
- jQuery中filter的使用
- 模态窗口的问题
- document.body.scrollLeft和document.body.scrollTop
- 怎么样在网上页把1000000显示成1,000,000谢谢
- 为什么我循环选择checkBox的时候,还剩最后一个的时候取不到值呢???
- 关于opener的问题
<HTML>
<HEAD>
<Title>Write to subwindow.</Title>
<Script language="JavaScript">
var newWindow
function makeNewWindow()
{
newWindow=window.open("","","status,height='200',width='300'");
}
function subWrite()
{
if(newWindow.closed){
makeNewWindow();
var newContent="<HTML><HEAD><Title>A new doc.</Title><HEAD>";
newContent+="<Body BGCOLOR='coral'><H1>This document is brand new.</h1>";
newContent+="Click the back button to see original document.";
newContent+="</Body></HTML>";
newWindow.document.write(newContent);
newWindow.document.close();
}
}
</Script>
</HEAD>
<body onLoad="makeNewWindow()">
<Form>
<input type="button" value="Write to Subwindow" onClick="subWrite()">
</Form>
</body>
</HTML>
{
makeNewWindow()
}
----xxuu503: 加了,還是有錯.
<HTML>
<HEAD>
<Title>Write to subwindow.</Title>
<script language="JavaScript">
var newWindow
function makeNewWindow(){
newWindow=window.open("","","status,height='200',width='300'");
}
function subWrite(){
if(newWindow.closed){
makeNewWindow();
var newContent="<HTML><HEAD><Title>A new doc.</Title><HEAD>";
newContent+="<Body BGCOLOR='coral'><H1>This document is brand new.</h1>";
newContent+="Click the back button to see original document.";
newContent+="</Body></HTML>";
newWindow.document.write(newContent);
newWindow.documemt.close();
}
}
</script>
</HEAD>
<body onLoad="makeNewWindow()">
<Form>
<input type="button" value="Write to Subwindow" onClick="subWrite()">
</Form>
</body>
</HTML>
这里除了你的代码都是可以运行的,不知你想要什么样的结果?
newWindow.documemt.close()
改為:
newWindow.document.close()