



locationプロパティは、フレームのURLを設定・参照します。
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"><title>フレーム使用例</title></head> <frameset rows="200,*"> <frame src="frame_location_ue " name="ue"> <frameset cols="50%,50%"> <frame src="frame_location_hidari " name="hidari"> <frame src="frame_location_migi " name="migi"> </frameset> </frameset> </html>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<script>
function sample_hidari() {
top.hidari.document.write(top.hidari.location);
}
function sample_migi() {
top.migi.document.write(top.migi.location);
}
</script>
</head>
<body>
<h3>上フレーム</h3>
<p><a onclick="sample_hidari()">ここをクリックすると左フレームのURLを書き出します。</a></p>
<p><a onclick="sample_migi()">ここをクリックすると右フレームのURLを書き出します。</a></p>
</body>
</html>
top.フレーム名.操作内容 …… トップフレームを操作する
parent.フレーム名.操作内容 …… 親フレームを操作する
self.操作内容 …… 自フレームを操作する
フレーム名.alert() …… 警告ダイアログを表示する
フレーム名.blur() …… フレームからフォーカスをはずす
フレーム名.confirm() …… 確認ダイアログを表示する
フレーム名.focus() …… フレームにフォーカスをあてる
フレーム名.prompt() …… 文字入力ダイアログを表示する