473,480 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

dynamic iframes

CroCrew
564 Recognized Expert Contributor
Hello everyone,

I am building a page that has two iframes (xFrame1, and xFrame2) in it.

Both the pages in the frames are the same and have like JavaScript function names within them.

I want to call a function on the parent page that would call the like named function within the selected iframe by passing in a value in the function on the parent page.

Here is my code on the parent page:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title></title>
  4.         <script type="text/javascript">
  5.             function UpdateFrame(FrameId)
  6.             {
  7.                 parent.('xFrame'+ FrameId).UpdatePage();
  8.             }
  9.         </script>
  10.     </head>
  11.     <body>
  12.         <label onclick="UpdateFrame(1);">Click Me to update frame 1</label>
  13.         <label onclick="UpdateFrame(2);">Click Me to update frame 2</label>
  14.  
  15.         <iframe id="xFrame1" src="xPage.htm"></iframe>
  16.         <iframe id="xFrame2" src="xPage.htm"></iframe>
  17.     </body>
  18. </html> 
  19.  

Here is my code on the framed pages (xPage.htm):
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title></title>
  4.         <script type="text/javascript">
  5.             function UpdatePage() 
  6.             {
  7.                 window.location='http://bytes.com'
  8.             }
  9.         </script>
  10.     </head>
  11.     <body>
  12.         Hello World
  13.     </body>
  14. </html> 
  15.  


Can anyone help me out here?


Thanks~
Aug 15 '08 #1
2 1557
gits
5,390 Recognized Expert Moderator Expert
just try:

Expand|Select|Wrap|Line Numbers
  1. frames['xFrame' + FrameId].UpdatePage();
in your parent page's function ...

kind regards
Aug 16 '08 #2
CroCrew
564 Recognized Expert Contributor
Thanks I will give it a try.
Aug 20 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
3898
by: maxim vexler | last post by:
I'm reading a lot of talks lately about the term iFrame and with your permission would like to ask a few question about that : - what is iFrame, i mean what is it good for ? - does all the...
0
2067
by: Dan Popa | last post by:
Check out the following 2 links: http://www.batisdev.com/admin/test_1images.asp http://www.batisdev.com/admin/test_2images.asp First page contain 4 IFRAMES and 1 IMG tags. Second page contain 4...
25
3420
by: jullag | last post by:
Hi, does anyone know of any javascript method that does the same job as document.write(), but not necessarily at the end of the document? For instance, insert some text inside an element that...
5
2204
by: Frances | last post by:
I need to replace iframes acc. to what option user chooses in a sel obj.. but figured have to load a blank iframe when pg loads so I can replace it.. (iframe gets put in a pre-existing div..) this...
2
2079
by: Guadala Harry | last post by:
1. Are IFrames supported only in uplevel versions of IE? If not IE exclusively, what browsers support IFrames? 2. Are IFrames going to be supported in the future - as far as anyone knows - or...
4
1757
by: Pete | last post by:
Hello- I am have a real trying time finding information on this subject. I would like to create a web page that utilizes framesets (top & bottom) and a navigation control I created from a datalist...
11
5941
by: f.ruecker | last post by:
Hey Guys, I've done my research for a script that dynamically adjusts the height of the Iframe, but none of the scripts have the features, which I all need. Maybe one of you can help me: 1. The...
9
2912
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
33
2944
by: Manikrag | last post by:
Hi Team, I have to adjust two pages which are provided by 2 diff. services based on some query string, as of now I am using iframes but could not set the height dynamically. Both the child pages...
0
6912
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...
0
7092
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...
1
6744
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
5348
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
4790
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
4488
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
3000
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
1304
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 ...
0
188
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...

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.