Click to See Complete Forum and Search --> : Why I can NOT invoke function of the other frame from one frame?


Jin Liying
May 4th, 2002, 02:44 AM
There are two frames:leftFrame and rightFrame. In rightFrame, there is a Test-function:
function Test()
{
alert("test");
}
In leftFrame, I write the following Javascript code:
parent.rightFrame.document.Test();
when I run the page, an error occur: Deny access.
How can I invoke the functions in another frame?
Thanks!

websmith99
September 27th, 2002, 02:42 PM
I notice 2 problems:

1. When calling a function on another frame using the DOM, the function call is a child of the frame itself.

example:

parent.rightFrame.myfunction(); <-- correct

parent.rightFrame.document.myfunction(); <--- incorrect


2. You named a function "Test()", and there is already a
built in regular expression method called "test()".


If you rename your function and remove "document." then it will
work on IE4+ and NN4+

:cool: