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

  • Thread starter Rasmus Rimestad
  • Start date
R

Rasmus Rimestad

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top