V
Vincent van Beveren
Hi everyone
I have a JavaScript app that creates an IFRAME through DOM
(createElement('IFRAME')) However, that IFRAME does not have any content
yet.
alert(iframe.contentWindow.document.documentElement)
gives null.
How can I, through DOM, create the root element? I can't find it.
My following question: In that IFRAME I need to load a stylesheet.
However, I can't seem to get the LINK in IFRAME thing working. I tried,
but IE 6 just seems to ignore the stylesheet speicified in the LINK. I
have the following code, in which win is the window of the IFRAME
(iframe.contentWindow).
eLink = win.document.createElement("LINK");
eLink.setAttribute("REL","stylesheet");
eLink.setAttribute("HREF", GUIstyleSheet);
eLink.setAttribute("TYPE","text/css");
win.document.documentElement.appendChild(eLink);
But this:
win.document.open();
win.document.writeln("<HTML><HEAD>");
win.document.writeln("<LINK REL=\"stylesheet\"
HREF=\""+GUIstyleSheet+"\" TYPE=\"text/css\">");
win.document.writeln("</HEAD><BODY></BODY></HTML>");
win.document.close();
does work? Does anyone know why? Or what I am doing wrong?
Thanks!
Vincent
I have a JavaScript app that creates an IFRAME through DOM
(createElement('IFRAME')) However, that IFRAME does not have any content
yet.
alert(iframe.contentWindow.document.documentElement)
gives null.
How can I, through DOM, create the root element? I can't find it.
My following question: In that IFRAME I need to load a stylesheet.
However, I can't seem to get the LINK in IFRAME thing working. I tried,
but IE 6 just seems to ignore the stylesheet speicified in the LINK. I
have the following code, in which win is the window of the IFRAME
(iframe.contentWindow).
eLink = win.document.createElement("LINK");
eLink.setAttribute("REL","stylesheet");
eLink.setAttribute("HREF", GUIstyleSheet);
eLink.setAttribute("TYPE","text/css");
win.document.documentElement.appendChild(eLink);
But this:
win.document.open();
win.document.writeln("<HTML><HEAD>");
win.document.writeln("<LINK REL=\"stylesheet\"
HREF=\""+GUIstyleSheet+"\" TYPE=\"text/css\">");
win.document.writeln("</HEAD><BODY></BODY></HTML>");
win.document.close();
does work? Does anyone know why? Or what I am doing wrong?
Thanks!
Vincent