473,657 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referencing parent window script from within iframe

If we have an iframe loaded from the same domain as the parent document,
how can we (is it possible) to execute a function on the parent
document's page?

e.g.
1) On parent page:
------------------
<script type="text/javascript">
<!-- Hide from w3c validator
function tester()
{
alert('tester') ;
}
//-->
</script>
2) Then we embed an iframe thus:
--------------------------------
<iframe id="locframe" src="iframepage .html" scrolling="no"
marginwidth="0" marginheight="0 " frameborder="0" ></iframe>


3) Then within the iframepage.html we have a button:
----------------------------------------------------
<input type="button" value="Execute parent.tester"
onclick="parent .document.teste r();" />

Should we be able to execute that function and if so how should it be
referenced?
--
jeremy

Nov 22 '06 #1
3 3327
Jeremy wrote:
1) On parent page:
------------------
<script type="text/javascript">
<!-- Hide from w3c validator
function tester()
{
alert('tester') ;
}
//-->
</script>

2) Then we embed an iframe thus:
--------------------------------
<iframe id="locframe" src="iframepage .html" scrolling="no"
marginwidth="0" marginheight="0 " frameborder="0" ></iframe>

3) Then within the iframepage.html we have a button:
----------------------------------------------------
<input type="button" value="Execute parent.tester"
onclick="parent .document.teste r();" />

Should we be able to execute that function and if so how should it be
referenced?
onClick="window .parent.tester( )"

--
Bart

Nov 22 '06 #2
In article <11************ **********@k70g 2000cwa.googleg roups.com>, Bart
Van der Donck says...
Should we be able to execute that function and if so how should it be
referenced?

onClick="window .parent.tester( )"


Thanks Bart - really appreciate the help.
--
jeremy
Nov 22 '06 #3
ASM
Jeremy a écrit :
If we have an iframe loaded from the same domain as the parent document,
how can we (is it possible) to execute a function on the parent
document's page?
3) Then within the iframepage.html we have a button:
----------------------------------------------------
<input type="button" value="Execute parent.tester"
onclick="parent .document.teste r();" />
onclick="parent .tester();"
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
41198
by: HolaGoogle | last post by:
Hi, Sorrryy to ask such basic question but i do need your help! Here's what i'm trying to do: In my parent form i'm calling a my Iframe form to get certain value, then depending on that value enable or disable my submit button in my parent form without using any refresh/reload or submit button in my form. Looks realy simple but i don't know how to get it work. actualy, i've been able to populate listbox,text boxes in my parent with...
2
4547
by: Randell D. | last post by:
Folks, I have got this working before, in part with some help from this ng but I never really understood how I got it working... and last time, I was using it via a popup window as opposed to an IFRAME. I've got several months of javascript under my belt and can resolve most things without errors in my Mozilla Javascript Console, but this one just does not do it for me. This is the picture:
26
45498
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function defined in "A.html", but every attempt results in an "is not a function" error. I have tried to invoke the function using parent.document.funcname(), top.document.funcname(), and various other identifying methods, but all result in the above...
2
23494
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an iframe on my page whose html has the refresh meta as follows : <meta http-equiv="refresh" content="10"> The iframe is effectivelyh refreshed every 10 seconds without having the
1
1028
by: John | last post by:
Hi all, I have a page which contains a few usercontrols inserted into placeholders on one main page. Inside one of these usercontrols is an iFrame tag which loads a page. If a user clicks on something within this page, I need to update a control in one of the other usercontrols elsewhere in the main page. How do I do this?
6
9374
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I can use it there. Thanks in advance :) Paul
8
52816
by: Henrik Stidsen | last post by:
I am trying to access a table in an iframe via javascript. It sounds easy - but it won´t work... The iframe is added to the document via someContainerElement.innerHTML = "<iframe...>", it has name and ID and its visible in my DOM explorer just as the table I need is it. The table is added from ASP.NET via Response.Write(). I have tried both window.frames, document.getElementById and even document.getElementsByTagName, nothing has...
4
19508
by: Jayyde | last post by:
Is there any way to capture a button click inside an iFrame and perform both an action on that page and one on the parent page? Basically I have a page atm that allows the user to add a record to a table and what I would like to have are save and cancel buttons (or maybe just a save button with a close image on the DHTML "window") on the page that, when save is clicked for instance, will save the record (code in that page) and close the...
1
9401
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.