Sto testando su this page e non sono sicuro di cosa mi manchi.Accesso all'oggetto documento di una cornice con 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
Sembra che questo dovrebbe funzionare, quindi qual è il problema? Deve funzionare in IE8, ma sto anche testando su Chrome (la nuova stabile).
In realtà stai utilizzando i frame nel 2013 o sono quegli iFrame? – adeneo
E riguardo 'document.getElementsByTagName (" frame ") [0] .contentDocument'? –
'var frame = document.getElementsByTagName (" frame ") [0]; var frame_doc = frame.contentWindow.document || frame.contentDocument; '- quindi usa' frame_doc' come documento del frame – Ian