最好去掉多余的东西:<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Javascript Editor 2">
<TITLE> Your title </TITLE>
</HEAD>
<BODY>
<script language="javascript">
win=open("about:blank","win","width=300,height=150")
document.writeln("<br><b>")
document.writeln("the created window is named:")
document.writeln(""+win.name+"</b>")
</script>
</BODY>
</HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Javascript Editor 2">
<TITLE> Your title </TITLE>
</HEAD>
<BODY>
<script language="javascript">
win=open("about:blank","win","width=300,height=150")
document.writeln("<br><b>")
document.writeln("the created window is named:")
document.writeln(""+win.name+"</b>")
</script>
</BODY>
</HTML>
你的“win.htm”是否存在
呵呵,
document.open()
document.close()
去掉吗?
about:blank是自动弹出的新窗口,与win.htm不一样,
两者有区别吗?
如果你指定的目标文件,如“win.html”不存在
就会出现问题。我已经试过了,就是这样。
about:blank只是使得“url”可以为空,
但指定其他文件名时,该文件必须存在
<HEAD>
<META NAME="GENERATOR" CONTENT="Javascript Editor 2">
<TITLE> Your title </TITLE>
</HEAD>
<BODY>
<script language="javascript">
var win=open("win1.htm","win","width=300,height=150")
win.document.open()
win.document.writeln("<br><b>")
win.document.writeln("the created window is named:")
win.document.writeln(""+win.name+"</b>")
win.document.close()
</script>
</BODY>
</HTML>