Solved

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

Posted on 2011-02-21
6
238 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Set differnt row widths in a table. 3 22
Add box and text color changing for everything 1 26
Why a span is lower 2 20
CSS: Making Pure CSS read more boxes thinner 5 31
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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.

810 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