473,473 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Iframes, child and parent

Hi to everyone!!!!

I have a problem. I need to call to a function of a child (set in an
iframe) from the parent.

Is it posible? I tried to do this with objects such as textbox
(changing its content) and there were no problems.

What can i do?

Thanks
Jul 23 '05 #1
1 1304
Oscar wrote:
Hi to everyone!!!!

I have a problem. I need to call to a function of a child (set in an
iframe) from the parent.

Is it posible? I tried to do this with objects such as textbox
(changing its content) and there were no problems.

What can i do?

Thanks


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">

iframe {
display: block;
width: 480px;
height: 362px;
margin: 0 auto;
overflow: auto;
}
button {
margin: 40px;
}

</style>
<script type="text/javascript">

function loadit()
{
return [ //HTML for the iframe, including foo()

'<html><head>' ,
'<style type="text/css">' ,
'.hi{background:url(http://img.' ,
'photobucket.com/albums/v668/' ,
'maryscottoconnor/handanim.gif);}' ,
'</style>' ,
'<script type="text/javascript">' ,
'function foo(str){' ,
'alert(str);' ,
'}<\/script>' ,
'</head>' ,
'<body class="hi">' ,
'</body></html>'

].join('');
}

</script>
</head>
<body>
<button onclick="if(frames.x&&frames.x.foo)frames.x.foo('H ello,
world.')">
frames.x.foo('Hello, world.')
</button>
<iframe
name="x"
frameborder="0"
src="javascript:parent.loadit()">
</iframe>
</body>
</html>

Always look before you leap...

if (frames.x --> iframe (object) exists?
&& frames.x.foo) --> function (object) exists?
frames.x.foo('....') --> OK, call it

Jul 23 '05 #2

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

Similar topics

8
by: Ashish | last post by:
Incase the problem got bogged down reposting... Hi Gregory, I think I didnt make myself much clear. The problem is: 1. I have one ASP.NET application (no classic asp) and it has a main page...
2
by: Andrew | last post by:
I have a parent iframe and 1 child iframe. when I click a button in the parent iframe, I want the whole page to be directed to another page. Right now, when I click on the button, only the child...
7
by: shocron | last post by:
problem: input values not recognized in dinamicly loaded IFRAMEs here is the thing I have a parent window that has an IFRAME I then load a diffrent page into the IFRAME that contains an input ...
0
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...
1
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...
0
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...
0
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,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.