阅读背景:

子窗口调用父窗口变量和函数示例

来源:互联网 

示例1:子窗口是新打开的窗口

 

父窗口:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" https://www.w3.org/1999/xhtml">
<head>
    <title>parent</title>
    <script type="text/javascript">
		var parentPara='parent';
		function parentFunction() {
			alert(parentPara);
		}
    </script>
</head>
<body>
	<button onclick="parentFunction()">显示变量值</button>
    <button onclick="window.open('child.html')">打开新窗口</button>
</body>
</html><!DOCTYPE html PUBL



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: