Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

calling jscript function from a page called in iframe - iframe src

Posted on 2011-02-21
6
Medium Priority
?
244 Views
Last Modified: 2012-05-11
Hi,
I am calling a page in iframe. Which I think ultimatly becomes a part of main page? please correct
In either case what I am trying to do is to call a jscript function such as,
function show_popup()
{ document.getElementById('display-frame').style.display = 'none';
   document.getElementById('waiting-div').style.display = 'block';}
these divs are present in the main page so does the iframe - in which I call this page
where onClick of the button I am trying to run the function - show_popup

As you may have judged, I get the error 'object doesn't exist' or 'object requred'
Just wondering if there is way to get over this?

Thanks for your help
0
Comment
Question by:SameerMirza
[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
  • 3
6 Comments
 
LVL 5

Expert Comment

by:wmadrid1
ID: 34946054
You can define the function show_popup()  on te ppal window,
and from the iframe page loaded, you can call it:
parent.show_popup();
0
 

Author Comment

by:SameerMirza
ID: 34946255
te ppal window?
0
 
LVL 5

Expert Comment

by:wmadrid1
ID: 34946264
sorry the confusion
main page
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Accepted Solution

by:
wmadrid1 earned 2000 total points
ID: 34946286
page1.htm
<script>
function message()
{
alert('Hello');
}
</script>
<iframe src='page2.htm'></iframe>

page2.htm
<a onclick="javascript: parent.message();" href="javascript: void();">
Do click
</a>
0
 

Author Comment

by:SameerMirza
ID: 34946318
ok thanks. I am sure it would work
will defiantly allocate the points tomorrow after testing it

Could you also have a look my other thread under the title, 'html display related issue', ID: 26828604
maybe you can advice

Thanks for your help
0
 

Author Closing Comment

by:SameerMirza
ID: 34951721
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

636 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