Unable to call function in from another frame in Opera and IE

Discussion in 'Javascript' started by Rasmus Rimestad, Mar 3, 2005.

  1. Hi!
    In a database application I am building I have a form which is constructed as two frames where the
    top frame (name == top) shows some information about the element currently displayed and the main
    frame (name == main) which contains the form itself.

    Now, I have a small image in the top frame which will change to become a floppy disk whenever the
    form in the main frame is changed so that the user is reminded to save what he/she has done.

    This works very well in Firefox, however in Opera and IE the functions changing the image work only
    when called from the top frame. When they are called from the main frame, the following error
    appears in Opera:


    http://localhost/index.php?c=participant&a=displayMain&participantID=10
    Event thread: onclick
    Error:
    name: TypeError
    message: Statement on line 1: Expression did not evaluate to a function object: parent.top.changeToDisk
    Backtrace:
    In unknown script
    parent.top.changeToDisk();
    At unknown location
    {event handler trampoline}

    IE ignores the entire thing, does nothing, and does not output any error either.

    The code looks like this:

    IN THE TOP FRAMEN:
    -= HTML: =-
    <img src="blank.gif" name="savedImg">


    -= JavaScript: =-
    changed = 'disk.gif';
    blank = 'blank.gif';

    function changeToDisk() {
    document.savedImg.src = changed;
    }

    function changeToBlank() {
    document.savedImg.src = blank;
    }

    function isNotChanged() {
    if(document.savedImg.src == changed) {
    alert('You have made changes!');
    return false;
    } else {
    return true;
    }
    }

    IN THE MAIN FRAME:
    -= HTML: =-
    <input type="text" name="firstName" maxlength="50" value="[field_firstName]" class="mediumText"
    onChange="parent.top.changeToDisk();">

    Does anyone know of any solutions to this?

    --
    Rasmus Rimestad, webprogrammerer
    Webdatabaser til en pris du kan leve med --> http://www.rimestad.no
     
    Rasmus Rimestad, Mar 3, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Søren M. Olesen
    Replies:
    0
    Views:
    611
    Søren M. Olesen
    Nov 13, 2003
  2. Microsoft
    Replies:
    3
    Views:
    720
    Hugo Wetterberg
    Oct 4, 2004
  3. Bob
    Replies:
    24
    Views:
    1,582
  4. Dan Tartakovsky
    Replies:
    5
    Views:
    171
    PeterB
    Dec 5, 2003
  5. Replies:
    0
    Views:
    117
Loading...

Share This Page