Results 1 to 2 of 2

Thread: Reference an Element in the Main Document from an IFRAME

  1. #1
    Join Date
    Oct 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Reference an Element in the Main Document from an IFRAME

    If I have a script that runs within an IFRAME that will change an element on the page which contains the IFRAME, what syntax would I use to reference the element on the main page?

    Obviously document.getElementById("headerDiv").innerHTML = "Hello World" would change the DIV if the script is executed via the main document, however what if the script is executed via a document contained within an IFRAME?

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    onclick (onload, whatever)='parent.document.getElementById("headerDiv").innerHTML = "Hello World"'

    Arie Molendijk.

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
  •