<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
// window.onload = function(){
// var box = document.getElementById('box');
// alert(box);
// }
</script>
</head>
<body>
<!-- <div id="box"></div> -->
<iframe src="./son.html" frameborder="1"></iframe>
</body>
<script>
name = '我是他爹 你是要访问我的属性吗?';
function func(){
return '我是父窗口func函数';
}
</script>
</html>点击 "运行实例" 按钮查看在线实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<button onclick="func1()">获取父窗口内容</button>
<button onclick="window.history.back()">后退 back</button>
<button onclick="window.history.go(-3)">后退go</button>
</body>
<script>
function func1(){
//alert(1);
alert(window.parent.name);
alert(window.parent.func());
}
</script>
</html>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号