?
Solved

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

Posted on 2011-02-21
6
Medium Priority
?
243 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

752 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