473,602 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ 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 1567
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
3914
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 popular browsers support it (mostly mozilla & the much hated IE, google says the do but nothing is better that experienced answer) - iFrames replaces the old frames once used in html to show a number of pages in a single windows, right ? - what are...
0
2082
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 IFRAMES and 2 IMGs tags. The problem is that the second IFRAME from the second page generates fires a new session.
25
3459
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 has a specific ID tag? thanks a lot JL
5
2225
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 is approach.. I'm having some problems and would appreciate some help.. thank you very much... var selItem; var ifrCurr; var div = document.getElementById("divPricing"); // this var not being read inside functions..
2
2088
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 have they been deprecated and will no longer be supported in the future? Please note that I'm *not* asking for opinions on the merits of using IFrames or IFrames vs regular framesets or any other such...
4
1764
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 that gets data from a sql datasource (sort of like a tabstrip). I'm getting pretty comforatable on the asp.net side of things, but I'm lacking in the javascript department. I understand that I need to add javascript to make the frames work...
11
5982
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 site contained in the Iframe is no on the same Domain nor Server as the main page 2. I can't put any code in the Iframe (YES, I do have permission to include the Iframe ;-)
9
2940
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 got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
33
2972
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 can came up with any height. and iframes are useless in this case as I have to set some height or else it will take the defualt value for height property. I tried to set it thru java script and css but got the "access denied error" as java...
0
7920
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,...
1
8054
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
8268
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
6730
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...
0
5440
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
3900
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
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
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 we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.