Solved

Master / Child pages

Posted on 2012-03-29
6
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

623 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