日期:2014-05-16  浏览次数:20333 次

关于window.open的问题
现在我需要打开一个新的窗口,并通过返回的变量来操作这个窗口。。
比如 var a=window.open(...)打开一个空的html文件
那么怎么通过操作返回的a来给这个空的html写入文本文档呢?
假设我的文本文档是通过创建request=new XMLHttpRequest(),然后根据request.responseText来获得的!本人是菜鸟!求高手指导啊!

------解决方案--------------------
主html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<script type="text/javascript">
var windowObjectReference;
var strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes,width=200px,height=200px";
windowObjectReference = window.open("http://www.apobates.com/openlab/demo.html", "CNN_WindowName", strWindowFeatures);

windowObjectReference.document.write ("hello world");
</script>
</body>
</html>

demo.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
</body>
</html>