Master / Child pages

I have a master page and numerous child pages derived from that page.  I have a button on the child page.  When I click the button, I want to call a Javascript function that exists in the master page.  I need to pass 2 parms to the function, an integer and a string.

I want the Javascript function in the master page because I do not want to copy and past it to all my child pages.

How can I do this?
LVL 1
HLRosenbergerAsked:
Who is Participating?
 
GwynforWebCommented:
use

opener.functionName()
0
 
CodeCruiserCommented:
You can call it without a problem

Just put a condition to make sure it exists

if(typeof functionname == 'function')
  functionname(x,y);
0
 
HLRosenbergerAuthor Commented:
Wonderful.    I did not realize I could do this...  So, once the master and child are combined into one page, any Javacript function is within scope of any other Javacript function ?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
HLRosenbergerAuthor Commented:
Why opener.functionName()?  verses just calling the function as a result of onClick?
0
 
HLRosenbergerAuthor Commented:
Thanks
0
 
GwynforWebCommented:
It won't work without using 'opener'.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.