Solved

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

Posted on 2011-02-21
6
235 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
  • 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 5

Accepted Solution

by:
wmadrid1 earned 500 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

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

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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…

757 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

22 Experts available now in Live!

Get 1:1 Help Now