www.webdeveloper.com
Results 1 to 3 of 3

Thread: A question about calling a function in an iframe

  1. #1
    Join Date
    Feb 2011
    Posts
    3

    Question A question about calling a function in an iframe

    Hi there
    I am wondering if anyone can tell me the best way to access the functions of an Iframe from the parent of the frame.
    I have tried



    Code:
    var myFrame = document.getElementById('gigmap');
    myFrame.flashMouseover(gid);
    and



    Code:
    window.frames['gigmap'].document.flashMouseover(gid);
    though these didn't work.

    Basically this is what i want: Mainpage function a(id) receives flash variable 'id' then sends variable 'number' to iframe function b(id).
    The part in red is where I have the problem.

    In case you are wondering what I am doing is sending an id of a gig in my database when its button rolled over in a flash swf to a Google Map (using Google maps javascript API inside the Iframe 'gigmap) and make the corresponding marker on the map jump. I have it so the iframed map markers send to the flash file on rollover though not the other way round...yet!

  2. #2
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    Is there an error?

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint] | twitter | linkedin | http://www.pascarello.com

  3. #3
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    A function belongs to the window, not to the document.
    Code:
    var myFrame = document.getElementById('gigmap');
    myFrame.contentWindow.flashMouseover(gid)
    Make sure your frame has an id. And hopefully, both documents belong to the same domain.

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