--------------------------------------------------------------
点此浏览示例文件
--------------------------------------------------------------
Javascript:
<script type="text/javascript"> <!-- function openWindow() { newWindow = window.open('','newWindow','height=300,width=300,scrollbars=auto'); if (newWindow != null) { var windowHTML= "<html><head><title>preview</title></head>"; windowHTML += "<body><h1 align='center'>"; windowHTML += "这是子窗口!</h1><hr><div align='center'><form action='#' method='get'>"; windowHTML += "<input type='button' value='将父窗口的背景设为红色' onclick='window.opener.document.bgColor=\"red\";' /><br>"; windowHTML += "<br ><input type='button' value='关闭' onclick='self.close();' />"; windowHTML += "</form></div></body></html>"; newWindow.document.write(windowHTML); newWindow.focus(); } } //--> </script>
HTML:
<input value='打开子窗口' onclick="openWindow();" type="button"> <input type="button" value="将子窗口的背景设为蓝色" onclick="if (window.newWindow){newWindow.document.bgColor='blue';newWindow.focus();}" />


