473,695 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Challenge: Call parent Javascript function from inside an iframe?

Hi geniuses (or is that genii, or genies)

The challenge is as above really. I have a page with an iframe in it, and
need to call a JS function in the *parent* page, *from* inside the iframe.

(It's for Google Maps, but I won't bore you with the complexities of that,
as it doesn't affect the question).

Mochas kudos to anyone able to solve this widdle.

Ta.
Apr 5 '06 #1
18 43551
Chris Ianson wrote:
Hi geniuses (or is that genii, or genies)

The challenge is as above really. I have a page with an iframe in it, and
need to call a JS function in the *parent* page, *from* inside the iframe.

(It's for Google Maps, but I won't bore you with the complexities of that,
as it doesn't affect the question).

Mochas kudos to anyone able to solve this widdle.


Still flogging the iframe 'dead horse' I see.

parent.yourfunc tion();
Don't try patenting it though...
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Apr 5 '06 #2
"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:44******** **************@ news.centralva. net...
Still flogging the iframe 'dead horse' I see.
:( By 'dead horse' I assume you mean 'now working perfectly in all
browsers'.
parent.yourfunc tion();
Sadly this doesn't seem to work for Google Maps API. Are there any other
methods to call JS from the parent frame?
Don't try patenting it though...


Too right, I have enough of them already...

TIA :)
Apr 5 '06 #3
Chris Ianson wrote:
"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:44******** **************@ news.centralva. net...
Still flogging the iframe 'dead horse' I see.


:( By 'dead horse' I assume you mean 'now working perfectly in all
browsers'.
parent.yourfunc tion();


Sadly this doesn't seem to work for Google Maps API. Are there any other
methods to call JS from the parent frame?

http://www.google.com/apis/maps/documentation/
Google Maps API Documentation
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Apr 5 '06 #4
"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:44******** **************@ news.centralva. net...
http://www.google.com/apis/maps/documentation/
Google Maps API Documentation


Yes, I am far too familiar with that URL having used it for the past few
weeks.

The question I have asked is not covered therein.

If anyone is able to provide an answer that would be great.

TIA.
Apr 5 '06 #5
Chris Ianson wrote:
"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:44******** **************@ news.centralva. net...
http://www.google.com/apis/maps/documentation/
Google Maps API Documentation


Yes, I am far too familiar with that URL having used it for the past few
weeks.

The question I have asked is not covered therein.

If anyone is able to provide an answer that would be great.


Sorry this IS how you reference a function in the parent frame. If it
does not work for you then you must be and error of how you are using
the function. Without URL only speculation.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Apr 5 '06 #6
"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:44******** **************@ news.centralva. net...
Sorry this IS how you reference a function in the parent frame. If it does
not work for you then you must be and error of how you are using the
function. Without URL only speculation.


Are you familiar with Google Maps API Jonathan? I have been working with an
expert in the field and neither of us can get it to work. If you are more
of an expert with the API then we can talk further.
Apr 5 '06 #7
Chris Ianson wrote:
"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:44******** **************@ news.centralva. net...
Sorry this IS how you reference a function in the parent frame. If it does
not work for you then you must be and error of how you are using the
function. Without URL only speculation.


Are you familiar with Google Maps API Jonathan? I have been working with an
expert in the field and neither of us can get it to work. If you are more
of an expert with the API then we can talk further.

I am familiar with web design, and JavaScript. That is how you reference
a JavaScript function in a non-named parent frame.

No Details
No URL
No Code.

What do you want?

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Apr 6 '06 #8
Hi guys,

sorry to break the 'this works - no this doesn't work' quarrel, but
Chris, have you tried something different?

I've never used Google Maps API, so I don't know if you have access to
code on the parent window. If you do, put a function over there that
access the Google Maps one, and your function in the IFrame then access
your function in the parent frame.

If that still doesn't work, try putting and invisible FRAME (not
IFrame) in the parent window to do the same 'proxy function' approach.
I had to do it once, in another problem. For some reason it was not
working from parent to child <-> child to parent frames, but taking
this proxy function approach solved the problem.

Also, are you passing 'objects' or functions as parameters in this
call?

Thanks,
Marcello

Apr 6 '06 #9
"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:44******** **************@ news.centralva. net...
Are you familiar with Google Maps API Jonathan? I have been working with
an expert in the field and neither of us can get it to work. If you are
more of an expert with the API then we can talk further.

Google Maps is a bit of an entity unto itself.
I am familiar with web design, and JavaScript. That is how you reference a
JavaScript function in a non-named parent frame.
....only it doesn't work with Google so...
What do you want?


....my question was a simple one which I will repeat for you as you are
asking what I want:
"Are there any other
methods to call JS from the parent frame?"
Apr 6 '06 #10

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

Similar topics

5
94256
by: Christian Radermacher | last post by:
I have document with an iframe in it. I'm able to call a javascript function in the main-document from the javascript inside the iframe-document. I have difficulties to do the other way round, i.e. to call a function in the iframe-document from javascript in the main-document. TIA Christian
11
41202
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
2415
by: Targa | last post by:
Not sure if this is the correct group for this but I assume this can be done with javascript. Basically, I have a page with a form on it. There is also an IFRAME on the page that has several form fields which contain the results of a database query. I need to be able to submit the form and have the fields in the IFRAME submitted along with it. Is there a way to do this with javascript?
26
45506
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...
9
2172
by: Paul | last post by:
HI! I need to call a function that is located in the parent. I need it so that it calls when the child page in the iframe loads. Would it be better to use an onload event in the body? if so how do I call it from the child page? -- Thanks in advance :) Paul
1
4728
by: Helixpoint | last post by:
I have a frameset. left and main. Inside the main frame I have a IFRAME. I need to refresh the main frame when I post a form inside the IFRAME. I am trying the code below with no luck?? Private Sub addMachine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addMachine.Click Dim sScript As New System.Text.StringBuilder sScript.Append("<SCRIPT language=""javascript"">" & vbCrLf)
6
9384
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
2
13802
by: Steven | last post by:
I have a page(pg1) which contains a select list (list1) in a form(form1) and an iframe(frame1), in this iframe is a page(pg2) with another select list(list2) in a form(form2) and I transfer the contents of list2 to list 1 as follows function transfer(){ for (var i=0; i<document.form2.list2.length; i++){ var cf=document.form2.list2; addOption(parent.document.form1.list1, document.form2.list2.value, document.form2.list2.value);
4
19512
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...
0
8565
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8977
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...
1
8841
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8822
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
7658
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
6488
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
5838
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();...
1
2997
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1971
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.