focus()メソッドは、指定したフレームにフォーカスをあてます。
<!DOCTYPE html> <html lang="ja"> <head><title>フレーム使用例</title></head> <frameset cols="300,*"> <frame src="frame_focus_hidari.htm" name="hidari"> <frame src="frame_focus_migi.htm" name="migi"> <noframes> このページはフレームを使用しています。 </noframes> </frameset> </html>
<!DOCTYPE html> <html lang="ja"> <head> <script> function sample() { top.migi.focus(); } </script> </head> <body> <h3>左フレーム</h3> <a onclick="sample()">ここをクリックすると右フレームにフォーカスがあたります。</a> </body> </html>
<!DOCTYPE html> <html lang="ja"> <head> </head> <body> <h3>右フレーム</h3> </body> </html>