[thelist] Iframes

Ben Henick persist1 at io.com
Thu Nov 14 08:46:09 CST 2002


On Thu, 14 Nov 2002, Stevenson Ngila wrote:

> How can i output data in an iframe? Am using:
>
> document.all.MainID.innerHTML = objXSLProc.output;
>
> where document.all.MainID is the iframe and objXSLProc.output is the details
> i want to output.
>
> Please assist!

Er, what error are you getting?

If the iframe has an src attached to it, you need to access it via its
associated document object (and may need to regardless).  MSDN's iframe
documentation should give you a good starting point.

One hopes that none of your users for this project are on Netscape 4.

For everyone else - and here I take a stab - the statements you might be
looking for are:

document.frames["MainID"].document.open();
document.frames["MainID"].document.write(objXSLProc.output);
// Ensure first that objXSLProc.output is properly escaped!
document.frames["MainID"].document.close();

Bear in mind that I avoid frames like the plague precisely because of
issues like these.  Assuming that you were working with conventional
frames and that your frameset wasn't nested, the preceding code would do
the trick with the exception that the frames array referenced would
belong to window, not document.

According to MSDN, document.all.MainID gives you access to the iframe
itself, rather than its content.


HTH
--
Ben Henick
Web Author At-Large              Managing Editor
http://www.io.com/persist1/      http://www.digital-web.com/
persist1 at io.com                  bmh at digital-web.com
--
"Are you pondering what I'm pondering, Pinky?"
"I think so, Brain, but... (snort) no, no, it's too stupid."
"We will disguise ourselves as a cow."
"Oh!" (giggles) "That was it exactly!"




More information about the thelist mailing list