|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
[菜鸟求助]JavaScript
看了N遍了,都不知道哪错了 [P42.html是在同一级目录下的网页]
<html>
<head>
<title>Writing to Subwindow</title>
<script language="JavaScript">
var newWindow
function makeNewWindow()
{
newWindow = window.open("P42.html","","status,height=200,width=300")
}
function subWrite()
{
// make new window if someone has closed it
if (newWindow.closed)
{
makeNewWindow ()
}
// bring subwindow to front
newWindow.focus ()
// assmeble content for new window
var newContent = "<html><head><title>A New Doc</title></head>"
newContent += "<body bgcolor='coral'><h1>This document is brand new.<h1>"
newContent += "</body></html>"
// write HTML to new window document
newWindow.document.write(newContent)
newWindow.document.close() // close layout stream
}
</script>
</head>
<body onLoad="makeNewWindow ()">
<form>
<input type="button" value="Write to Subwindow" onClick="subWrite ()">
</form>
</body>
</html> |
没报错哦。
[html]
<html>
<head>
<title>Writing to Subwindow</title>
<script language="JavaScript">
var newWindow
function makeNewWindow()
{
newWindow = window.open("P42.html","","status,height=200,width=300")
}
function subWrite()
{
// make new window if someone has closed it
if (newWindow.closed)
{
makeNewWindow ()
}
// bring subwindow to front
newWindow.focus ()
// assmeble content for new window
var newContent = "<html><head><title>A New Doc</title></head>"
newContent += "<body bgcolor='coral'><h1>This document is brand new.<h1>"
newContent += "</body></html>"
// write HTML to new window document
newWindow.document.write(newContent)
newWindow.document.close() // close layout stream
}
</script>
</head>
<body onLoad="makeNewWindow ()">
<form>
<input type="button" value="Write to Subwindow" onClick="subWrite ()">
</form>
</body>
</html>
[/html] |
我觉得代码本来的意思,不是要在开这个网页的时候,同时弹出一个网页(P42.html),吗,点按钮的时候,会报错哦 |
顶上去,高手回答一下呀
|
没报错 |
我知道怎么回事了....被Google和上网助手给拦了.....无语...... |
|