this pageでテストしています。私は何が欠けているのか分かりません。JavaScriptを使用したフレームのドキュメントオブジェクトへのアクセス
// Two frames on the page
> document.getElementsByTagName("frame").length
2
// Same domain, so no security restrictions
> document.getElementsByTagName("frame")[0].src
"http://www.quackit.com/html/templates/frames/menu_1.html"
> window.location.href
"http://www.quackit.com/html/templates/frames/frames_example_1.html"
// Can't access the document
> document.getElementsByTagName("frame")[0].document
undefined
これはうまくいくようですが、何が問題なのですか? IE8で動作する必要がありますが、私はChromeでもテストしています(最新の安定版)。
実際に2013年にフレームを使用していますか、それともiFrameですか? – adeneo
'document.getElementsByTagName(" frame ")[0] .contentDocument'はどうでしょうか? –
'var frame = document.getElementsByTagName(" frame ")[0]; var frame_doc = frame.contentWindow.document || frame.contentDocument; 'フレームのドキュメントとして' frame_doc'を使用します。 – Ian