www.webdeveloper.com
Results 1 to 2 of 2

Thread: Accessing the top DOM from an iframe

Hybrid View

  1. #1
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    700

    Accessing the top DOM from an iframe

    Hi all,
    I'm trying to change the display of a div in the top document according from within an iframe.

    I thought top.document.getElementById('this').style.display = 'none' would do the trick, but I get a 'Permission Denied' error.

    How do I access and manipulate the DOM from within an iframe?
    Oh Lord, please help me be the person my dog thinks I am.

  2. #2
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    700
    I trawled through some stuff I did a few years back and found the solution to this problem...

    If I put a javascript function called, say, myfunction() in the top page, then from the iFrame, I can call it with;
    parent.myfunction()

    myfunction() can then access the DOM from within its own page.
    Oh Lord, please help me be the person my dog thinks I am.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles