Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Javascript function from a different frame.

Status
Not open for further replies.

MrMilton

Programmer
Feb 25, 2004
6
CA
Is it possible to call a client-side javascript function from a different frame?

I have a btn_OnClick() function that i would like to call... could it be done like this?

top.framename.btn_OnClick();

I need to avoid cutting and pasting the function from the page it resides on now.

Thanks.

MrMilton
 
top.framename.btn_OnClick();

that's correct, provided you replace "framename" with the name of the frame that the function btn_OnClick() is defined in

e.g.

if myFunction() is defined in fooFrame, and i want to call it from barFrame, in barFrame i would say:

top.fooFrame.myFunction();


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top