プロが教える店舗&オフィスのセキュリティ対策術

フレームページのソース
<frameset rows="100%,66,*" border=0 frameborder=0 framespacing=0 framecolor="#000000">
<frame name=metrouser src="x.html" scrolling=auto>
<frame name=metroowner src="m.html" scrolling=no marginheight=2 marginwidth=0>
</frameset>
---------------------------
以上のような場合に、x.htmlに記述したjavascriptでm.htmlのページを制御したいのです。ただし、frameには名前が付いていないことに注意してください。

したい制御方法
・ページを変える
 たぶん、location.href=を使えばよいと思うのですが、よく分かりません。
・フレームの幅を変える
 100%,66,* から任意のものに変更する

以上の2通りの制御方法を教えて欲しいです。
よろしくお願いいたします。

A 回答 (2件)

>・ページを変える


parent.frames[1].location="***.htm" または
parent.metroowner.location="***.htm" と指定してください。

>100%,66,* から任意のものに変更する
ウインドウの広さに対するサイズを%で指定するか、
ピクセルサイズを数字で指定するか、
残りのサイズは*で指定してください。

この例の場合、フレームは2つあるため、
rowsの指定は、2つ指定するだけでいいです。

参考URL:http://tohoho.wakusei.ne.jp/www.htm

この回答への補足

ページの変更については分かりました。ありがとうございました。

フレームのサイズの変更についてなのですが、
ページの移動同様フレームで指定されたページからのjavascriptで変えたいのです。
言葉が足らず、申し訳ございません。

補足日時:2001/07/09 18:17
    • good
    • 0

質問No.84725 「フレーム分割領域のサイズを変更する」の


No.2の回答に手を加えてみました。
--- index.html ---
<html>
<head><title>タイトル</title>
<script language="javascript">
<!--
function frset(a,b,f1,f2){
var frset=
'<frameset rows="'+a+','+b+'" border=0 frameborder=0 framespacing=0 framecolor="#000000">\n'
+'<frame name=metrouser src="'+f1+'" scrolling=auto>\n'
+'<frame name=metroowner src="'+f2+'" scrolling=no marginheight=2 marginwidth=0>\n'
+'</frameset>\n'
return frset
}
document.write(frset('100%','66','x.html?','m.html?'))
//-->
</script>
<noscript>
<frameset rows="100%,66,*" border=0 frameborder=0 framespacing=0 framecolor="#000000">
<frame name=metrouser src="x.html" scrolling=auto>
<frame name=metroowner src="m.html" scrolling=no marginheight=2 marginwidth=0>
</frameset>
</noscript>
</head>
</html>
--- x.html ---
<html>
<head><title></title>
<script language="javascript">
<!--
function chsize(a,b){
if(location.search==""){
if(document.all){
parent.document.all.tags("frameset")[0].rows=a+","+b
}else{
//parent.document.open()
parent.document.write(frset(a,b,parent.frames[0].location.href+"?",parent.frames[1].location.href+"?"))
parent.document.close()
}
}
}
//-->
</script>
</head>
<body>
<a href="#" onclick="chsize('60%','40%')">こっち側を60%にする!</a><BR>
<a href="#" onclick="chsize('40%','60%')">こっち側を40%にする!</a>
</body>
</html>
--- m.html ---
<html><body>あいうえお</body></html>
--- 終わり ---

参考URL:http://oshiete1.goo.ne.jp/kotaeru.php3?q=84725
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!