定义和用法
parent属性返回当前窗口的父窗口。
语法
window.parent所有主要浏览器都支持 parent 属性
实例
当打开新窗口时,在父窗口弹出警告:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web176教程(Web176.com)</title>
</head>
<head>
<script>
function openWin(){
window.open('','','width=200,height=100');
alert(window.parent.location);
}
</script>
</head>
<body>
<input type="button" value="打开窗口" onclick="openWin()">
</body>
</html>作者:terry,如若转载,请注明出处:https://www.web176.com/javascriptbook/brtips/3645.html
支付宝
微信