473,802 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing to an IFRAME's innerHTML

How do I set the innerHTML property of a contained IFRAME ?

Many thanks in advance,

Aaron
Aug 26 '08 #1
22 9527
"Aaron Gray" <an********@gma il.comwrote in message
news:6h******** ****@mid.indivi dual.net...
How do I set the innerHTML property of a contained IFRAME ?
I got

window.frames["results"].document.body. innerHTML

This works on FF and Opera, but not on IE.

Aaron


Aug 26 '08 #2
"Aaron Gray" <an********@gma il.comwrites:
"Aaron Gray" <an********@gma il.comwrote in message
news:6h******** ****@mid.indivi dual.net...
>How do I set the innerHTML property of a contained IFRAME ?

I got

window.frames["results"].document.body. innerHTML

This works on FF and Opera, but not on IE.
IIRC, window.frames["results"].document.conte ntWindow.docume nt.body.innerHT ML

should work on IE.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Aug 26 '08 #3

"Joost Diepenmaat" <jo***@zeekat.n lwrote in message
news:87******** ****@zeekat.nl. ..
"Aaron Gray" <an********@gma il.comwrites:
>"Aaron Gray" <an********@gma il.comwrote in message
news:6h******* *****@mid.indiv idual.net...
>>How do I set the innerHTML property of a contained IFRAME ?

I got

window.frames["results"].document.body. innerHTML

This works on FF and Opera, but not on IE.

IIRC,
window.frames["results"].document.conte ntWindow.docume nt.body.innerHT ML

should work on IE.
window.frames["result"].document.conte ntWindow.docume nt

Is saying the above is null or not an object.

I have an IFRAME thus :-

<iframe id="result" name="result"></iframe>

Confused, they sure do make this stuff easy !

Aaron
Aug 26 '08 #4
"Aaron Gray" <an********@gma il.comwrites:
"Joost Diepenmaat" <jo***@zeekat.n lwrote in message
news:87******** ****@zeekat.nl. ..
>"Aaron Gray" <an********@gma il.comwrites:
>>"Aaron Gray" <an********@gma il.comwrote in message
news:6h****** ******@mid.indi vidual.net...
How do I set the innerHTML property of a contained IFRAME ?

I got

window.frames["results"].document.body. innerHTML

This works on FF and Opera, but not on IE.

IIRC,
window.frame s["results"].document.conte ntWindow.docume nt.body.innerHT ML

should work on IE.

window.frames["result"].document.conte ntWindow.docume nt

Is saying the above is null or not an object.
http://msdn.microsoft.com/en-us/libr...92(VS.85).aspx

You may want to leave out the first "document".
Confused, they sure do make this stuff easy !
Of course they don't.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Aug 26 '08 #5
"Joost Diepenmaat" <jo***@zeekat.n lwrote in message
news:87******** ****@zeekat.nl. ..
"Aaron Gray" <an********@gma il.comwrites:
>"Joost Diepenmaat" <jo***@zeekat.n lwrote in message
news:87******* *****@zeekat.nl ...
>>"Aaron Gray" <an********@gma il.comwrites:

"Aaron Gray" <an********@gma il.comwrote in message
news:6h***** *******@mid.ind ividual.net...
How do I set the innerHTML property of a contained IFRAME ?

I got

window.frames["results"].document.body. innerHTML

This works on FF and Opera, but not on IE.
IIRC,
window.fram es["results"].document.conte ntWindow.docume nt.body.innerHT ML

should work on IE.

window.frames["result"].document.conte ntWindow.docume nt

Is saying the above is null or not an object.

http://msdn.microsoft.com/en-us/libr...92(VS.85).aspx
Wow, great documentation, looks really old stuff.
You may want to leave out the first "document".
Tried that :-

window.frames.r esult.contentWi ndow.document is null or not an object

Again
>Confused, they sure do make this stuff easy !

Of course they don't.
Cant find any good documentation on it, tried W3C standard approach too.

Aaron
Aug 26 '08 #6
"Aaron Gray" <an********@gma il.comwrites:
window.frames.r esult.contentWi ndow.document is null or not an object
In the posts above you refer to

window.frames.r esults

with an S at the end.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Aug 26 '08 #7
"Joost Diepenmaat" <jo***@zeekat.n lwrote in message
news:87******** ****@zeekat.nl. ..
"Aaron Gray" <an********@gma il.comwrites:
> window.frames.r esult.contentWi ndow.document is null or not an object

In the posts above you refer to

window.frames.r esults

with an S at the end.
Yes, its not that, sorry to confuse.

I am wondering whether it was banned as a secuity problem.

Aaron
Aug 26 '08 #8
On Aug 26, 5:38*pm, "Aaron Gray" <ang.use...@gma il.comwrote:
"Joost Diepenmaat" <jo...@zeekat.n lwrote in message

news:87******** ****@zeekat.nl. ..
"Aaron Gray" <ang.use...@gma il.comwrites:
* * window.frames.r esult.contentWi ndow.document is null or not an object
In the posts above you refer to
window.frames.r esults
with an S at the end.

Yes, its not that, sorry to confuse.

I am wondering whether it was banned as a secuity problem.

Aaron
If the document in the iframe is on another site it will throw an
exception. Security issue.
If you catch the exception and show it in an alert box, it will say
something like:
"Error: Permission denied to get property Window.document "

I have recently accessed an iframe like so:

frames['name_of_the_fr ame'].document

here is another article on the topic:
http://xkr.us/articles/dom/iframe-document/

As to the innerHTML, can I ask why you want this? I'm pretty certain
that if you are trying to manipulate the document in the iframe, you
don't want the innerHTML.

Here is where I recently piddled around with iframes:
http://polisick.com/crossdomainformattempt.php
Aug 26 '08 #9
"Doug Gunnoe" <do********@gma il.comwrote in message
news:7f******** *************** ***********@59g 2000hsb.googleg roups.com...
>
here is another article on the topic:
http://xkr.us/articles/dom/iframe-document/
-
Thats great, it works when on a button or on body onload, but not executed
as inline javascript.

That was my problem !
>As to the innerHTML, can I ask why you want this? I'm pretty certain
that if you are trying to manipulate the document in the iframe, you
don't want the innerHTML.
For test purposes when testing AJAX.

Thanks that helped alot !:)

Aaron

Aug 27 '08 #10

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

Similar topics

12
9803
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ---------------------------------------------------------------------------- -------------------------------------------- Here's how the site works: You should press a button in the rollover area in order to load a source file on an Iframe, this Iframe is actually hidden working as a Buffer. The body of this loaded Iframe is...
1
2352
by: Reply Via Newsgroup | last post by:
Folks, I have a cell in a table that has an IFRAME - The IFRAME is empty (ie it has no source tag) but it does have a name (myFrame) and id (also called myFrame). I can write data to the frame, but cannot append to it - I know I could put a textarea form box in there, however that is my least prefered route in part because I have such little control over the display of the contents that appears inside a <textarea> are box.
7
4871
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+ doesn't seem to have the problem. I'm doing: this.iframe = document.createElement( 'iframe' ); this.iframe.id = this.id + 'wh'; this.iframe.style.display = 'none';
4
5142
by: L Anthony Johnson | last post by:
Has anyone had any success doing this. I have tried, but the InnerHTML property always comes back as an empty string. L Anthony Johnson
9
11189
by: aatcbbtccctc | last post by:
Hi folks I've googled for an answer to this, with no success. Can someone please jump in, and put me out of my misery! (I'm sure it's quite simple) I have an invisible IFRAME, and a visible DIV: <IFRAME id=myframe style="display:none" src="..." onload="ShowNews(this)"></IFRAME>
14
18294
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>
8
52831
by: Henrik Stidsen | last post by:
I am trying to access a table in an iframe via javascript. It sounds easy - but it won´t work... The iframe is added to the document via someContainerElement.innerHTML = "<iframe...>", it has name and ID and its visible in my DOM explorer just as the table I need is it. The table is added from ASP.NET via Response.Write(). I have tried both window.frames, document.getElementById and even document.getElementsByTagName, nothing has...
4
32176
by: Yansky | last post by:
Is it possible to read the DOM of an iframe if the iframe's src is from another domain? I realise I can't manipulate the DOM from another domain for security reasons, but can I access the DOM and just read object's values? This is what I've tried so far without any success: document.getElementsByTagName("iframe").contentWindow; document.getElementsByTagName("iframe").innerHTML;
5
1628
by: Ketty | last post by:
Hi Experts, I am trying this bit of code which is not working right. <script language="JavaScript" type="text/JavaScript"> <!-- function showHide(divName) { var x = new getObj(divName); document.writeln(x.name); //document.writeln(x.value);
0
9699
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
9562
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,...
0
10536
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10304
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
10063
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
6838
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
5494
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...
1
4270
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
2
3792
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.