473,407 Members | 2,598 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,407 software developers and data experts.

iframe innerHTML

(code is at end of post)
-------------------------------------------
I'm using an i-frame to grab a server-side text file and display its content
elsewhere in the html document. On change of the i-frame source, I want to
access its innerHTML.

The i-frame source changes just fine and even displays the source; the glitch
is in accessing the innerHTML for that new i-frame src file. It requires *TWO*
clicks of the onClick element to get the correct innerHTML (with just one
click, the source will change, and display the new file in the html document;
however, the innerHTML is still that of the old source file for the i-frame).
This does not appear to be a loading problem with the new src file into the
i-frame. (ie: setTimeout on a function to get the innerHTML after the src file
loads does not work).

So the question is: how can I get the i-frame source to change AND access the
new src file's innerHTML with one click??

Ideas, suggestions, changes appreciated.

Thankyou,

Jim
------------------- C O D E -------------------
// framer is the new src file name for the i-frame;
// eyeframe is the i-frame element id
// myframe is the i-frame element name
// centerbox inner is the div container for the new content

function contentChange(framer){
document.getElementById('eyeframe').src = framer;
document.getElementById('centerboxinner').innerHTM L
=window.frames['myframe'].document.body.innerHTML
}
Jul 20 '05 #1
4 8883
>From: ji*******@aol.comNoSpam (JimMenees)
I'm using an i-frame to grab a server-side text file
and display its content elsewhere in the html document.
On change of the i-frame source, I want to access its
innerHTML.


Instead of trying to load it into an IFrame and then grab its
innerHTML, why not use an HTTPRequest to simply grab
the file, parse whats in the body, and then display it?

http://jibbering.com/2002/4/httprequest.html
--
Randy
Jul 20 '05 #2
hi************@aol.com (HikksNotAtHome) writes:
Instead of trying to load it into an IFrame and then grab its
innerHTML, why not use an HTTPRequest to simply grab
the file, parse whats in the body, and then display it?


Because there are more browsers supporting iframes and innerHTML
than HTTPRequest?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
In article <ad**********@hotpop.com>, Lasse Reichstein Nielsen <lr*@hotpop.com>
writes:
hi************@aol.com (HikksNotAtHome) writes:
Instead of trying to load it into an IFrame and then grab its
innerHTML, why not use an HTTPRequest to simply grab
the file, parse whats in the body, and then display it?


Because there are more browsers supporting iframes and innerHTML
than HTTPRequest?


When deciding how to do something, my first thought is always to try to do it
the most efficient way. And an HTTPRequest (where it works) is more efficient
than loading the file into an IFrame and reading it's innerHTML property. If
for no other reason, because you skip the browser having to render it first
before reading it.

But there are advantages and disadvantages to both approaches.
--
Randy
Jul 20 '05 #4
On 30 Dec 2003 23:33:03 GMT, hi************@aol.com (HikksNotAtHome)
wrote:
Because there are more browsers supporting iframes and innerHTML
than HTTPRequest?


When deciding how to do something, my first thought is always to try to do it
the most efficient way. And an HTTPRequest (where it works) is more efficient
than loading the file into an IFrame and reading it's innerHTML property. If
for no other reason, because you skip the browser having to render it first
before reading it.


also and in many cases more importantly for me, innerHTML in many
browsers doesn't give you the source document you tried to load, but a
normalised approximation of the parse tree it got from the document.
It also runs script etc.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #5

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

Similar topics

12
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 ----------------------------------------------------------------------------...
1
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...
7
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+...
4
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
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...
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>
8
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...
4
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...
5
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);...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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
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...
0
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
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,...
0
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...

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.