フレームにないページをindex.htmlにリダイレクトしています。インデックスがindex.htmlに変更されていますか?page.htmlJavaScriptを使用してフレームを設定する
アドレスから追加の部分を使用し、フレームのSRCをこの値に設定します。
location.search.substring(1)
を正しく含める方法がわからないため、エラーは発生しません。
各サイトには、コードを持っています
if (top.location == self.location)
{
top.location = 'index.html?' + location.href.replace(/^.*[\\\/]/, '');
}
インデックスページは、私は私の前questionからこのアイデアを得た右
<frameset rows="100px,100%" cols="*" border="0">
<frame src="logo.html" name="logo" scrolling="no">
<frameset rows="*" cols="200,100%" border="0">
<frame src="menu.html" name="menu" scrolling="no">
<script language="javascript">
if (location.search && location.search.length > 1 && location.search.charAt(0) == "?")
{
document.write('<frame src="' + location.search.substring(1) + '" name="page" scrolling="auto">');
}
else
{
document.write('<frame src="main_page.html" name="page" scrolling="auto">');
}
</script>
</frameset>
</frameset>
後に含まれています。
BTW。私もこれを行うべきですか?もっと良い解決策はありますか?
'location'は、各フレーム(' window'-object)内のグローバルオブジェクトです。 'top.window.location'や' window.location'のように指定してください。 'location'自体は、既にリダイレクトされていなければ、hrefという名前のプロパティから見つかるページの現在のURLを表していません。 'href'はページのURLを変更するためにも使われます。 – Teemu
@テムー、あなたが言っていることを見ているが、それをどのように機能させるかわからない。 – HelpNeeder