www.webdeveloper.com
Results 1 to 2 of 2

Thread: acess div that is outside of a iframe

  1. #1
    Join Date
    Aug 2007
    Posts
    4

    acess div that is outside of a iframe

    hi,
    i have in main index a div called teste
    <div id="teste"><b>over</b></div

    and i want acess this div"change de content" from a iframe

    if i want acess this div"change de content" in the same place i use this:
    document.getElementById("teste").innerHTML=xpto

    but how can i change inside a iframe?
    thanks for your help

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    An iframe is a window and has its own document. You can access things using the same techniques as regular frames. Something along these lines:

    A div in the iframe from the main window:
    Code:
    window.top.framename.document.getElementById("teste").innerHTML = xpto;
    A div in the main window from the iframe:
    Code:
    window.top.document.getElementById("teste").innerHTML = xpto;

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