Click to See Complete Forum and Search --> : call function on another page?!?


Magic Man
11-09-2003, 05:10 PM
I have a issue with a menu I am working on. It is in a frame set. I also have all of my js code in a .js file. This .js file is loaded on every page because it contains things for various needs.

What I need to do is allow links on the content page to activate a script to hi-lite the link on the menu. The script resides in the .js file so is present for all pages. The script on the menu page keeps a variable so that it knows when a link has been clicked, and when a new link is clicked, the old link is cleared and the new one hi-lited.

The problem is that I need to call the hi-lite function on the menu page. It will keep the proper variable for the hi-lited link as the function run from the content page has no variable set. I have tried several things with no luck. I know it is possible to do this but I am unsure what the syntax should be.

I have tried the following:

parent.frames[0].document.someFunction();
parent.menu.document.someFunction();
window.document.menu.document.someFunction();

None of these have worked. I can pass variables back and forth using these, but have not been able to call a function.

Any help with this problem would be appreciated!

Shampie
11-09-2003, 06:58 PM
Hey,

you might want to call the .js file in the main page aswell as in the frame page.
then you can call for the function in the main page (example)
clicking a button on the mainpage and call funtion needsoup()
(lets just say the mainpage contains a textbox named mptxt and the frame page (which name will be frmp(the name can be found on the page that hold the frame info)) contains a textbox named frmptxt)

function needsoup(){
this.parent.mptext.value = "I am modified now!";
parent.frmp.frmptxt.value = "And so am I!";
}

I hope this will give you an idea how to do it.

Good luck!