SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Oct 2004
    Location
    Five Islands
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question IE DOM Iframe Trouble

    Hi all, I know this is really more of a DOM or IE DOM question than a js one but the js forum seems to be the most fitting...

    I am working on a page where I have included an instance of FCK Editor (which is just a script that creates your standard Rich Text Editor interface inside a form).

    What I want to do is call a function which retrieves the newly typed data (along with the formatting) and does something with it.

    The "problem" is that FCK creates it interface inside an Iframe inside another IFrame. No problem for FireFox, Netscape, etc... It just a matter of a couple "getElementById()"s and "contentDocument"s. However IE does not support contentDocument. Instead IE puts all Frames (including IFrames) in the frames array. Which is fine, I can still navigate my way down the tree to my target Iframe with document.frames[0].frames[0]... the trouble is, you cannot (or I can't figure out how) to access elements on the page inside the nested Iframes. I can access properties of the Iframes (such as location).

    I'm thinking that this is how IE is "supposed" to work but is there any way that I can access elements inside a page inside of an Iframe or nested Iframes?

    Someone PLEASE HELP!
    Thanks
    -TJ

    -------------------------------------------------------
    OK So now I feel like a complete Tool. After working on this project for hours on end tonight, I hit the aforementioned roadblock. I guess I was suffering a little mental fatigue... The solution is actually ridiculously simple and anyone who has read this question is probably laughing, but In my defence, I've never claimed to be a js guy, mainly PHP and MySQL. But in case there is someone else with this situation here's the solution:

    document.frames[0].frames[0] gets me inside the target Iframe... now here is the DUH!... add .document.... yup that simple, document.frames[0].frames[0].document, from there you can retrieve title, body, and other child elements.

    Thanks for laughing at me
    Last edited by TJ1000000; Mar 30, 2007 at 18:01. Reason: Problem Solved


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •