473,594 Members | 2,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing window.parent from HTML contained in dynamically created IFRAME

Hi,

The following javascript code (serving a main HTML page) dynamically
creates
IFRAME to contain other HTML page. Everyting works OK, however when I
am trying
to access the main HTML page elements from the child page by
window.parent.d ocument... a javascript error is accepted.
Any Idea?
TIA Boris

function OpenLayer (HtmlName, atop, aleft, awidth, aheight, acolor)
{
DIVText = '<DIV ID = "LayerDiv"> </DIV>';
var newDiv = document.create Element(DIVText );
FormID.insertBe fore(newDiv);
document.all.La yerDiv.style.po sition = "absolute";
document.all.La yerDiv.style.to p = atop;
document.all.La yerDiv.style.le ft = aleft;
document.all.La yerDiv.style.ba ckground = acolor;
document.all.La yerDiv.style.vi sibility = "visible";
OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor);
}

function OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor)
{
HTMLText = '<IFRAME '
HTMLText += 'SRC=' + HtmlName + ' ';
HTMLText += 'ID="IFrameLaye r" ';
HTMLText += 'NAME="f1" ';
HTMLText += 'WIDTH="' + awidth + '" ';
HTMLText += 'HEIGHT="' + aheight + '" ';
HTMLText += 'BGCOLOR="' + acolor +'" ';
HTMLText += 'scrolling="NO" frameborder="NO "';
HTMLText += '><\/IFRAME>';
LayerDiv.insert AdjacentHTML('B eforeEnd', HTMLText);
}
Jul 23 '05 #1
1 2643
me******@bezeqi nt.net (BGMeshi) wrote in message news:<df******* *************** ****@posting.go ogle.com>...
Hi,

The following javascript code (serving a main HTML page) dynamically
creates
IFRAME to contain other HTML page. Everyting works OK, however when I
am trying
to access the main HTML page elements from the child page by
window.parent.d ocument... a javascript error is accepted.
Any Idea?
TIA Boris

function OpenLayer (HtmlName, atop, aleft, awidth, aheight, acolor)
{
DIVText = '<DIV ID = "LayerDiv"> </DIV>';
var newDiv = document.create Element(DIVText );
FormID.insertBe fore(newDiv);
document.all.La yerDiv.style.po sition = "absolute";
document.all.La yerDiv.style.to p = atop;
document.all.La yerDiv.style.le ft = aleft;
document.all.La yerDiv.style.ba ckground = acolor;
document.all.La yerDiv.style.vi sibility = "visible";
OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor);
}

function OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor)
{
HTMLText = '<IFRAME '
HTMLText += 'SRC=' + HtmlName + ' ';
HTMLText += 'ID="IFrameLaye r" ';
HTMLText += 'NAME="f1" ';
HTMLText += 'WIDTH="' + awidth + '" ';
HTMLText += 'HEIGHT="' + aheight + '" ';
HTMLText += 'BGCOLOR="' + acolor +'" ';
HTMLText += 'scrolling="NO" frameborder="NO "';
HTMLText += '><\/IFRAME>';
LayerDiv.insert AdjacentHTML('B eforeEnd', HTMLText);
}

Something else I noticed while testing this code: this.name in the
script serving the child HTML page gives a name of IFRAME (f1) (I.e
element on the parent HTML) instead the name of appropriate element on
the child HTML!
Jul 23 '05 #2

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

Similar topics

5
8168
by: Lee | last post by:
I am using a modal window and an iFrame to try and pull a return value back. I am doing this across domains. I have the value returned from the modal window to the iFrame window but I can not get the value returned to the parent window. The alert in the parent window always returns undefined errors. Any help would be much appreciated. I call the modal window and wait for the return as such: function LCC()
2
3499
by: veganeater | last post by:
Hello again everyone, I seem to have run into another problem... perhaps I'm just a bit slow. The problem is something like this: I have a popup window launched by a page sourced in an iFrame and would like to find a method to close all windows (popups) when the master window is closed. I have found a fair amount of documentation on this fairly straightforward process however, it would seem that the inclusion of iFrames screws with...
4
4971
by: Paul Brant | last post by:
Hi all, I have a page with an IFRAME in it. From a script in the main ( parent ) page I instruct the IFRAME to load a specific URL. The URL contains parameters that are processed by the server. The server then writes a result cookie into the content destined for the IFRAME. I am having issues accessing the cookie. If I use a debuger I can see the cookie via a quickwatch looking at window.frames.document.cookie however when I run the...
1
1762
by: onali1811 | last post by:
Hi, I have a page which has a div tag like following: <div name="searching" id="searching" style="width:100px;display:block;float:left">Searching...</div> Now i have an iframe, which also has some javascript. i try to access this div from the iframe using the following:
14
18274
by: Aaron Gray | last post by:
Hi, I want to access the properties of an IFrame but seem unable to get access to the IFrames document body. <html> <body> <iframe src="test.html" id="IFrame"></iframe> </body>
1
2586
by: adamredwards | last post by:
I have a page with some form elements that are dynamically generated. They are inserted into the dom by first cloning a node, changing the values like name, and then inserted with insertBefore(). When a field gets added, a link that opens a popup window is next to it. The popup is opened and has the name of the parent element it should change in it. The user can use the popup to get a list of results. In the results I would like them...
2
3272
by: Vivek | last post by:
I have two html files Parent.htm and Child .htm Following is the code inside the Parent.htm: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="vs_targetSchema"
2
2144
by: KC | last post by:
Hi, Every JavaScript executive context has a top-level window and we can use window.open() to open another window ... Does this related to Windows created by click on "File"->"New Window" or "File" -"New Tab" in browser's menu bar ? I think window created by "File"->"New Window" and "File"->"New Tab" are independent to each other from JavaScript's point of view. Is this correct ?
4
19504
by: Jayyde | last post by:
Is there any way to capture a button click inside an iFrame and perform both an action on that page and one on the parent page? Basically I have a page atm that allows the user to add a record to a table and what I would like to have are save and cancel buttons (or maybe just a save button with a close image on the DHTML "window") on the page that, when save is clicked for instance, will save the record (code in that page) and close the...
0
7947
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
8374
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
8242
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
6665
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
5739
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
5413
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
3868
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
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1486
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.