Window parentプロパティ

Window 对象参考手册Window オブジェクト

定義と使い方

parent プロパティは現在のウィンドウの親ウィンドウを返します。

構文

window.parent


ブラウザサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザが parent プロパティをサポートしています。


例

例

新しいウィンドウを開いたとき、親ウィンドウに警告を表示します:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.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>

試してみる »


Window 对象参考手册Window オブジェクト その他の拡張