A
Aaron Gray
How do I set the innerHTML property of a contained IFRAME ?
Many thanks in advance,
Aaron
Many thanks in advance,
Aaron
Aaron Gray said:How do I set the innerHTML property of a contained IFRAME ?
Aaron Gray said:Aaron Gray said:How do I set the innerHTML property of a contained IFRAME ?
I got
window.frames["results"].document.body.innerHTML
This works on FF and Opera, but not on IE.
Joost Diepenmaat said:Aaron Gray said:Aaron Gray said:How do I set the innerHTML property of a contained IFRAME ?
I got
window.frames["results"].document.body.innerHTML
This works on FF and Opera, but not on IE.
IIRC,
window.frames["results"].document.contentWindow.document.body.innerHTML
should work on IE.
Aaron Gray said:Joost Diepenmaat said:Aaron Gray said:How do I set the innerHTML property of a contained IFRAME ?
I got
window.frames["results"].document.body.innerHTML
This works on FF and Opera, but not on IE.
IIRC,
window.frames["results"].document.contentWindow.document.body.innerHTML
should work on IE.
window.frames["result"].document.contentWindow.document
Is saying the above is null or not an object.
Confused, they sure do make this stuff easy !
Joost Diepenmaat said:Aaron Gray said:Joost Diepenmaat said:How do I set the innerHTML property of a contained IFRAME ?
I got
window.frames["results"].document.body.innerHTML
This works on FF and Opera, but not on IE.
IIRC,
window.frames["results"].document.contentWindow.document.body.innerHTML
should work on IE.
window.frames["result"].document.contentWindow.document
Is saying the above is null or not an object.
http://msdn.microsoft.com/en-us/library/ms533692(VS.85).aspx
You may want to leave out the first "document".
Of course they don't.
Aaron Gray said:window.frames.result.contentWindow.document is null or not an object
Joost Diepenmaat said:In the posts above you refer to
window.frames.results
with an S at the end.
Yes, its not that, sorry to confuse.
I am wondering whether it was banned as a secuity problem.
Aaron
-Doug Gunnoe said:here is another article on the topic:
http://xkr.us/articles/dom/iframe-document/
As to the innerHTML, can I ask why you want this? I'm pretty certain
that if you are trying to manipulate the document in the iframe, you
don't want the innerHTML.
Aaron Gray said:Its now a two liner :-
//
// getFrameDoc() - get the document for a frame window
//
// Note: this must be executed via body.onload or later
//
function getFrameDoc( frame)
{
var doc = (frame.contentWindow || frame.contentDocument);
return doc.document || doc
}
Aaron said:function getFrameDoc( frame)
{
var doc = (frame.contentWindow || frame.contentDocument);
return doc.document || doc
}
I have also found this will only work for a frame got by id, not from
window.frames[] :-
var framedoc = getFrameDoc( document.getElementById('myframe'));
works, where :-
var framedoc = getFrameDoc( window.frames["myframe"])
throws an error.
Thomas 'PointedEars' Lahn said:Aaron said:"Aaron Gray" <[email protected]> wrote [...]:
Please do not write attribution novels, see <http://insideoe.com/>
(Windows Mail is Outlook Express's successor).
function getFrameDoc( frame)
{
var doc = (frame.contentWindow || frame.contentDocument);
return doc.document || doc
}
I have also found this will only work for a frame got by id, not from
window.frames[] :-
var framedoc = getFrameDoc( document.getElementById('myframe'));
works, where :-
var framedoc = getFrameDoc( window.frames["myframe"])
throws an error.
You could be a bit more specific. Which error, on which line, in which
runtime environment?
Aaron Gray said:var framedoc = getFrameDoc( document.getElementById('myframe'));
works, where :-
var framedoc = getFrameDoc( window.frames["myframe"])
throws an error.
Tried that :-
window.frames.result.contentWindow.document is null or not an object
Lasse said:Aaron Gray said:var framedoc = getFrameDoc( document.getElementById('myframe'));
works, where :-
var framedoc = getFrameDoc( window.frames["myframe"])
throws an error.
Without having read the rest of the thread, so I don't know what
getFrameDoc does, [...]
var framedoc = getFrameDoc( window.frames["myframe"])
throws an error.
Thomas said:And your signature delimiter is borken; must be "--<SP><CR><LF>":
optimistx said:Would somebody explain me the word 'borken'? Google gives this answer in
english to the query define:borken
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.