473,594 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do call a function from inside an iframe?

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
Sep 21 '05 #1
9 2164
Paul wrote:
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?

This should work just fine.

<iframe onload="self.fo o()">

</iframe>

--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Sep 21 '05 #2
Hi,
Onload fires when the whole page (including iframes) has loaded. You'd put
the function call in the body of the parent page, eg
<body onload="someFun ction();">

--
Cheers,
Jon
Microsoft MVP

"Paul" <pa***********@ sympatico.ca> wrote in message
news:de******** ************@ne ws20.bellglobal .com...
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

Sep 21 '05 #3
ASM
Paul wrote:
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?


in the child page :

<body onload="parent. myFunction()">

--
Stephane Moriaux et son [moins] vieux Mac
Sep 21 '05 #4
HI! Thanks, I will try it. :)

Paul

"Jon Spivey" <jo**@mvps.or g> wrote in message
news:ee******** ******@TK2MSFTN GP14.phx.gbl...
Hi,
Onload fires when the whole page (including iframes) has loaded. You'd put
the function call in the body of the parent page, eg
<body onload="someFun ction();">

--
Cheers,
Jon
Microsoft MVP

"Paul" <pa***********@ sympatico.ca> wrote in message
news:de******** ************@ne ws20.bellglobal .com...
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


Sep 21 '05 #5
HI! I want to simulate resizing the parent page page by using this function.

<script language="JavaS cript">
function firefoxautofix( x,y,){
parent.window.r esizeBy(-1,-1)
parent.window.r esizeBy(+1,+1)
}
</script>

Should this function be in the head or the body?

I want to get around a small bug in firefox that does not seem to resize (
after a iframe resize script is executed) the body unless the user refreshes
the page or resizes the browser manually from left to right. So I figure
that I would try to simulate a manual resize with this script.

Would I just call it like so.

<body onload="firefox autofix();">

--
Thanks in advance :)

Paul
"Paul" <pa***********@ sympatico.ca> wrote in message
news:de******** ************@ne ws20.bellglobal .com...
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

Sep 21 '05 #6
HI! thanks asm I think I might use this method.
Thanks

Paul
"ASM" <st************ *********@wanad oo.fr.invalid> wrote in message
news:43******** **************@ news.wanadoo.fr ...
Paul wrote:
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?


in the child page :

<body onload="parent. myFunction()">

--
Stephane Moriaux et son [moins] vieux Mac

Sep 21 '05 #7
ASM
Paul wrote:
HI! I want to simulate resizing the parent page page by using this function.

<script language="JavaS cript">
function firefoxautofix( x,y,){
parent.window.r esizeBy(-1,-1)
parent.window.r esizeBy(+1,+1)
}
</script>

Should this function be in the head or the body?

I want to get around a small bug in firefox
is it really a bug ?
thought on validate conventions an iFrame can't be resized ?
that does not seem to resize (
after a iframe resize script is executed) the body unless the user refreshes
the page or resizes the browser manually from left to right. So I figure
that I would try to simulate a manual resize with this script.

Would I just call it like so.

<body onload="firefox autofix();">


you're joking ?

--
Stephane Moriaux et son [moins] vieux Mac
Sep 21 '05 #8
Note that firefox has an option setting to disable scripts that resize
the browser - I believe this is the default setting.
In FireFox: Tools->Options->Web Features - Advanced button
--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
"Paul" <pa***********@ sympatico.ca> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
HI! I want to simulate resizing the parent page page by using this
function.

<script language="JavaS cript">
function firefoxautofix( x,y,){
parent.window.r esizeBy(-1,-1)
parent.window.r esizeBy(+1,+1)
}
</script>

Should this function be in the head or the body?

I want to get around a small bug in firefox that does not seem to
resize ( after a iframe resize script is executed) the body unless
the user refreshes the page or resizes the browser manually from
left to right. So I figure that I would try to simulate a manual
resize with this script.

Would I just call it like so.

<body onload="firefox autofix();">

--
Thanks in advance :)

Paul
"Paul" <pa***********@ sympatico.ca> wrote in message
news:de******** ************@ne ws20.bellglobal .com...
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


Sep 21 '05 #9
Thanks for pointing that out. I have already get that though. that's anyways
:)

Paul
"Ronx" <ro*****@hotmai l.com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
Note that firefox has an option setting to disable scripts that resize the
browser - I believe this is the default setting.
In FireFox: Tools->Options->Web Features - Advanced button
--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
"Paul" <pa***********@ sympatico.ca> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
HI! I want to simulate resizing the parent page page by using this
function.

<script language="JavaS cript">
function firefoxautofix( x,y,){
parent.window.r esizeBy(-1,-1)
parent.window.r esizeBy(+1,+1)
}
</script>

Should this function be in the head or the body?

I want to get around a small bug in firefox that does not seem to resize
( after a iframe resize script is executed) the body unless the user
refreshes the page or resizes the browser manually from left to right. So
I figure that I would try to simulate a manual resize with this script.

Would I just call it like so.

<body onload="firefox autofix();">

--
Thanks in advance :)

Paul
"Paul" <pa***********@ sympatico.ca> wrote in message
news:de******** ************@ne ws20.bellglobal .com...
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



Sep 21 '05 #10

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

Similar topics

5
94246
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
26
45491
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...
13
6679
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is getting as far as the iframe section as other parts of the html code work correctly. But it is not executing any code within the getPage() function as some "hello world" writes within getPage() wouldn't print. ...
18
43533
by: Chris Ianson | last post by:
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.
4
3851
by: Ty | last post by:
Hello all, I am creating a web site with Visual Stuido 2008. I am trying to use a java script file to create a busybox for login from this page http://blogs.crsw.com/mark/articles/642.aspx. I am using a master page senerio. The erro I'm getting is 'busyBox' is not a member of 'ASP.login2_aspx'
6
2627
by: Revathi Balakrishnan | last post by:
i am trying to disable some of the anchor tags which are linked with particular onmouseover and onmouseout events.i have written a javascript function.when i called this function on load of the document body, it is able to disable the tags.But when the body of the page has iframes, this script is unable to disable the tags with in the iframes. since "document.getelemetbytags" is not returning the anchor tags with in the iframe.so i need to put...
1
2945
by: bnashenas1984 | last post by:
Hi everyone I'v seen several websites doing what I'm asking now but I don't know how they do it. Lets say we have an E-commerce website that has a shopping cart inside an IFrame which shows what products have been added. Users should be able to add comments for each product inside the shopping cart (in the Iframe) . When the user clicks on the product a new popup window opens which allows him to add the comment and then save. But...
0
7946
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
8251
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
8372
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
8003
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
8234
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
5408
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
3859
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...
0
3897
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1210
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.