By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,384 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,384 IT Pros & Developers. It's quick & easy.

How do call a function from inside an iframe?

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
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.foo()">

</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

P: n/a
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="someFunction();">

--
Cheers,
Jon
Microsoft MVP

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

P: n/a
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

P: n/a
HI! Thanks, I will try it. :)

Paul

"Jon Spivey" <jo**@mvps.org> wrote in message
news:ee**************@TK2MSFTNGP14.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="someFunction();">

--
Cheers,
Jon
Microsoft MVP

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

P: n/a
HI! I want to simulate resizing the parent page page by using this function.

<script language="JavaScript">
function firefoxautofix(x,y,){
parent.window.resizeBy(-1,-1)
parent.window.resizeBy(+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="firefoxautofix();">

--
Thanks in advance :)

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

P: n/a
HI! thanks asm I think I might use this method.
Thanks

Paul
"ASM" <st*********************@wanadoo.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

P: n/a
ASM
Paul wrote:
HI! I want to simulate resizing the parent page page by using this function.

<script language="JavaScript">
function firefoxautofix(x,y,){
parent.window.resizeBy(-1,-1)
parent.window.resizeBy(+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="firefoxautofix();">


you're joking ?

--
Stephane Moriaux et son [moins] vieux Mac
Sep 21 '05 #8

P: n/a
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****************@TK2MSFTNGP14.phx.gbl...
HI! I want to simulate resizing the parent page page by using this
function.

<script language="JavaScript">
function firefoxautofix(x,y,){
parent.window.resizeBy(-1,-1)
parent.window.resizeBy(+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="firefoxautofix();">

--
Thanks in advance :)

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

P: n/a
Thanks for pointing that out. I have already get that though. that's anyways
:)

Paul
"Ronx" <ro*****@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
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****************@TK2MSFTNGP14.phx.gbl...
HI! I want to simulate resizing the parent page page by using this
function.

<script language="JavaScript">
function firefoxautofix(x,y,){
parent.window.resizeBy(-1,-1)
parent.window.resizeBy(+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="firefoxautofix();">

--
Thanks in advance :)

Paul
"Paul" <pa***********@sympatico.ca> wrote in message
news:de********************@news20.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 discussion thread is closed

Replies have been disabled for this discussion.