www.webdeveloper.com
Results 1 to 2 of 2

Thread: Add code to parent from iframe?

  1. #1
    Join Date
    Mar 2005
    Posts
    79

    Add code to parent from iframe?

    As a newbie in terms of javscript coding I'm really struggling to work out if the following is possible:


    What I want to be able to do from within an iframe is:


    check if

    parent.window.document.getElementById("autoloadpop") is null


    I guess that would be:

    if (parent.window.document.getElementById('autoload') == null) { etc



    but then I want to add:

    <a href='popup.php' id='autoloadpop' onclick="return hs.htmlExpand(this, { contentId: 'popup', objectType: 'iframe', width: 620, maxHeight: 400} )"></a>

    to an existing div with the id 'main-header' in the parent page.


    and then make the following call:

    parent.window.document.getElementById('autoloadpop').onclick();



    Any help would be greatly appreciated.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    parent.document.getElementById("autoloadpop")

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