catching events in a seperate frame ?.....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sylvian Stone

    #1

    catching events in a seperate frame ?.....

    Hi,

    I suspect that this may not be possible, but this is my little
    problem.

    I have a main page ('index.php') with an iframe ('mainframe') on the
    left hand side. All the links on the index page load a new page of
    mainly text content into the iframe.

    All pretty straightforward , but I am using some javascript to launch
    and hide a floating div on the index page (if I launch it in the
    iframe, it will be restricted to the height and width of that frame).
    The code to show / hide the div is located on the page index.php - say
    the function is called 'showMe()', I would call top.showMe() to launch
    the div.

    The Div works fine, but when I try and catch an event via:

    event.srcelemen t

    it returns the error message 'object required', because it is being
    passed from a link on a totally seperate page (the iframe)...

    Is there any method for the main page (index.php) to catch the event
    on 'mainframe' that triggers the div ?

    The div's do show up and hide, and I can load source content into them
    - only error messages keep flashing up on IE (but not on Netscape /
    Firefox, etc)...

    Is this possible ?

    Thanks
    Neil.
  • Martin Honnen

    #2
    Re: catching events in a seperate frame ?.....



    Sylvian Stone wrote:

    [color=blue]
    > The Div works fine, but when I try and catch an event via:
    >
    > event.srcelemen t
    >
    > it returns the error message 'object required', because it is being
    > passed from a link on a totally seperate page (the iframe)...[/color]

    In IE's event model each window/frame has an event object so for events
    in the iframe you need the event object of the iframe e.g.
    parent.showMe(w indow.event);
    with
    function showMe (evt) {
    // access evt.srcElement here
    }

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...