473,883 Members | 2,141 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 2185
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
94267
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
45554
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
6722
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
43583
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
3886
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
2642
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
2959
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
9948
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
9798
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
11164
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
10767
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
10422
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
9588
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
7980
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
6008
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3242
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.