Solved

Master / Child pages

Posted on 2012-03-29
6
301 Views
Last Modified: 2012-03-30
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?
0
Comment
Question by:HLRosenberger
  • 3
  • 2
6 Comments
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 37783213
You can call it without a problem

Just put a condition to make sure it exists

if(typeof functionname == 'function')
  functionname(x,y);
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 37783256
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
 
LVL 31

Accepted Solution

by:
GwynforWeb earned 250 total points
ID: 37783408
use

opener.functionName()
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:HLRosenberger
ID: 37783488
Why opener.functionName()?  verses just calling the function as a result of onClick?
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 37783505
Thanks
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 37787733
It won't work without using 'opener'.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now