Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Master / Child pages

Posted on 2012-03-29
6
Medium Priority
?
323 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 1000 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 1000 total points
ID: 37783408
use

opener.functionName()
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

721 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