Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Changing the outerHTML of an Iframe

Reply
Thread Tools

Changing the outerHTML of an Iframe

 
 
David Virgil Hobbs
Guest
Posts: n/a
 
      04-11-2006
I discovered how to write out the inner HTML of the contents of an
Iframe; I want to know how to write out the outerHTML of the contents
of an Iframe.

frames['iframeid'].document.body.innerHTML allows me to read the inner
HTML of the contents of an iframe and also allows me to write out the
inner HTML of the contents of an iframe.

However using frames['iframeid'].document.body.innerHTML I am only able
to change, in the contents of the iframe, the code in between and
including the body tags; I am not able to change the code above the
body tag such as what is in the head section and what is in the html
tag.

The problem is, that other maneuvers that allow me to read the contents
of an iframe, do NOT allow me to write out the contents of the iframe.
These are:

frames['framid'].document.body.outerText
frames['framid'].document.body.innerText
frames['framid'].document.documentElement.outerHTML

The problem persists if the page originally loaded into the iframe
contains no code.

This looks like an unpredictable inconsistency of the type that makes
Javascript a language to be learned through experimentation. Or is
there some documentation somewhere that lists the read/write abilities
of such lines of code?

 
Reply With Quote
 
 
 
 
Danny
Guest
Posts: n/a
 
      04-11-2006

Well, outerHTML is IE only for one, and from msnd kb ->

Applies To
A, ACRONYM, ADDRESS, APPLET, AREA, B, BDO, BGSOUND, BIG, BLOCKQUOTE,
BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, CUSTOM, DD,
DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM,
FRAMESET, hn, HR, HTML Comment, HTML, I, IFRAME, IMG, INPUT
type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden,
INPUT type=image, INPUT type=password, INPUT type=radio, INPUT
type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LABEL,
LEGEND, LI, LISTING, MAP, MARQUEE, MENU, nextID, NOBR, OBJECT, OL, P,
PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, SPAN, STRIKE,
STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR,
TT, U, UL, VAR, WBR, XMP
----------------------------------
The property is read/write for all objects except the following, for
which it is read-only: CAPTION, COL, COLGROUP, FRAMESET, HTML, TBODY,
TD, TFOOT, TH, THEAD, TR. The property has no default value.

It doesn't include BODY.

Danny
 
Reply With Quote
 
 
 
 
Neredbojias
Guest
Posts: n/a
 
      04-11-2006
To further the education of mankind, "David Virgil Hobbs"
<(E-Mail Removed)> declaimed:

> I discovered how to write out the inner HTML of the contents of an
> Iframe; I want to know how to write out the outerHTML of the contents
> of an Iframe.


The last time I checked, outerHTML didn't work in most of my browsers.

--
Neredbojias
Infinity can have limits.
 
Reply With Quote
 
Daniel Kirsch
Guest
Posts: n/a
 
      04-11-2006
David Virgil Hobbs wrote:
> However using frames['iframeid'].document.body.innerHTML I am only able
> to change, in the contents of the iframe, the code in between and
> including the body tags; I am not able to change the code above the
> body tag such as what is in the head section and what is in the html
> tag.


Instead of using innerHTML you may create a new document and use
document.write()

You may also access the head element by using DOM methods like:
var htmlElm = document.documentElement;
var headElm = htmlElm.getElementsByTagName("head")[0];

But what are you trying to do in the head?
To change the title, you may use
document.title = "foo";

Daniel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
outerHTML not working in Firefox John Kotuby ASP .Net 4 06-27-2007 03:41 PM
OuterHTML - loosing polish fonts schapopa ASP .Net 0 01-24-2005 01:28 PM
OuterHTML - loosing polish fonts schapopa ASP .Net 0 01-24-2005 12:58 PM
Get form values from iframe (1) to iframe (2) inside a layer in iframe (1) Daedalous Javascript 3 01-16-2004 11:08 AM
Is there an equivalent to outerHTML in Netscape 4? Aron Javascript 1 07-09-2003 03:25 PM



Advertisments