473,232 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,232 software developers and data experts.

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.document... 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.createElement(DIVText);
FormID.insertBefore(newDiv);
document.all.LayerDiv.style.position = "absolute";
document.all.LayerDiv.style.top = atop;
document.all.LayerDiv.style.left = aleft;
document.all.LayerDiv.style.background = acolor;
document.all.LayerDiv.style.visibility = "visible";
OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor);
}

function OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor)
{
HTMLText = '<IFRAME '
HTMLText += 'SRC=' + HtmlName + ' ';
HTMLText += 'ID="IFrameLayer" ';
HTMLText += 'NAME="f1" ';
HTMLText += 'WIDTH="' + awidth + '" ';
HTMLText += 'HEIGHT="' + aheight + '" ';
HTMLText += 'BGCOLOR="' + acolor +'" ';
HTMLText += 'scrolling="NO" frameborder="NO"';
HTMLText += '><\/IFRAME>';
LayerDiv.insertAdjacentHTML('BeforeEnd', HTMLText);
}
Jul 23 '05 #1
1 2610
me******@bezeqint.net (BGMeshi) wrote in message news:<df**************************@posting.google. 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.document... 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.createElement(DIVText);
FormID.insertBefore(newDiv);
document.all.LayerDiv.style.position = "absolute";
document.all.LayerDiv.style.top = atop;
document.all.LayerDiv.style.left = aleft;
document.all.LayerDiv.style.background = acolor;
document.all.LayerDiv.style.visibility = "visible";
OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor);
}

function OpenHTML (HtmlName, atop, aleft, awidth, aheight, acolor)
{
HTMLText = '<IFRAME '
HTMLText += 'SRC=' + HtmlName + ' ';
HTMLText += 'ID="IFrameLayer" ';
HTMLText += 'NAME="f1" ';
HTMLText += 'WIDTH="' + awidth + '" ';
HTMLText += 'HEIGHT="' + aheight + '" ';
HTMLText += 'BGCOLOR="' + acolor +'" ';
HTMLText += 'scrolling="NO" frameborder="NO"';
HTMLText += '><\/IFRAME>';
LayerDiv.insertAdjacentHTML('BeforeEnd', 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
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...
2
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 ...
4
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....
1
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...
14
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
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(). ...
2
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>...
2
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...
4
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.