note から WordPress に出戻りました!😭

[ JavaScript ] ウィンドウ内にフレームを開きページを表示するサンプル

だるかぶ

サンダルでスーパーカブ乗りの『だるかぶ』です!
ご訪問ありがとうございます。ゆっくりしていってね。(本ページは広告を含みます。)

同じウィンドウに別フレームを開き、その中のページを入れ替える JavaScript のサンプルです。

サンプルコード

index.html

<HTML>
<HEAD>
<TITLE>Javascript Sample</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
</HEAD>
<BODY bgcolor="#FFFFFF" leftmargin="20" topmargin="20" marginwidth="20" marginheight="20">
<P>同じウィンドウに別フレームを開き、その中のページを入れ替える</P>
<P><a href="//www.goo.ne.jp/" target="_top" rel="noopener">http://www.goo.ne.jp/</A></P>
<P><a href="//www.yahoo.co.jp/" target="_top" rel="noopener">http://www.yahoo.co.jp/</A></P>
</BODY>
</HTML>

frame.html

<HTML>
<HEAD>
<TITLE>Javascript Sample</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
</HEAD>
<FRAMESET rows="100,1*"> 
    <FRAME src="index.html" >
    <FRAME src="null.html">
</FRAMESET>
<NOFRAMES>
<BODY bgcolor="#FFFFFF">
</BODY>
</NOFRAMES>
</HTML>

null.html

<HTML>
<HEAD>
<TITLE>Javascript Sample</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<script language="JavaScript">
<!--
function loaded(n) {
    if (n.length <= 1) {
        // location.href = '' ;
        parent.top.location.replace('index.html');
    } else {
        // location.href = n.substring(1,n.length) + '.html' ;
        // location.replace(n.substring(1,n.length) + '.html') ;
        location.replace(n.substring(1,n.length)) ;
    }
}
//-->
</script>
</HEAD>
<BODY bgcolor="#FFFFFF" onLoad="loaded(top.location.search);">
</BODY>
</HTML>

現場からは以上です。それでは、またッ!!!