Solved

Master / Child pages

Posted on 2012-03-29
6
299 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

760 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

26 Experts available now in Live!

Get 1:1 Help Now