473,782 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing the outerHTML of an Iframe

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.docum entElement.oute rHTML

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?

Apr 11 '06 #1
3 2305

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
Apr 11 '06 #2
To further the education of mankind, "David Virgil Hobbs"
<vi*******@rcn. com> 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.
Apr 11 '06 #3
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.docume ntElement;
var headElm = htmlElm.getElem entsByTagName(" head")[0];

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

Daniel
Apr 11 '06 #4

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

Similar topics

3
11271
by: Pai | last post by:
Hello there, I have the following peice of javascript which works with IE but would not work with mozilla. In IE the first for loop is entered but in mozilla i would not enter the for loop any tips / ideas? var tblObj=document.body.getElementsByTagName("TD")
5
4217
by: Jim Marquardson | last post by:
Hi, I've struggled with this for a while now, so I'm asking for help. I am trying to click on a link in one page, have that link open up in a new window, and set that newly opened window's ifram to a specific url. Here is the code I'm using: <html> <head>
1
13310
by: prasaddevivara | last post by:
I am using the outerHTML property to modify the HTML of existin elements in a web page in Internet Explorer. But same outerHTM property is not working in firefox browser, Anybody can tell me a alternative for outerHTML property in firefox. I am using th following function to display an image and alternate text behind al images of a weg page in Internet Explorer. Anybody can give solutio for same in firefox browser. function...
2
4070
by: Rob | last post by:
Hi Gang: I have a page that loads a remote page into an IFRAME. I don't have any control over this remote page though the page is owned by the same company I work for. The problem is that all of the pages have <base target='_parent'> specified -- so every link will bust out of the IFRAME. One solution I thought of was to load the page via a server side language,
3
3424
by: David Virgil Hobbs | last post by:
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.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.document.body.innerHTML I am only able to change, in the contents of the iframe, the code in...
1
3547
by: cweeks | last post by:
Dev env: VS 2005 C# Express, .Net Framework 2.0 I am trying to programmatically select an item in a listbox on a web page. The first thing I do is go through and de-select any selected items. The OuterHtml field of a selected element in the listbox looks something like this: <OPTION value=* selected>Default item</OPTION> I want to simply remove the the term 'selected' this way:
4
6460
by: libsfan01 | last post by:
hey this code wont work for my iframe in safari, i cant change the page by changing the src with js: <script language="javascript"> function loadcontent(page) { document.getElementById('iframeid').src = page; } </script>
3
7357
by: bulldog8 | last post by:
I am having problems with changing a frames source file for Mozilla (1.5.0.4). The followig code works for IE: <script type="text/javascript"> var imgP = new Image(); function ShowPic(ShowThis, wdth, hght) { imgP.src = "../pics/' + ShowThis + '" xw = 500; yh = 500*(hght/wdth); window.document.getElementById("graphic").innerHTML = '<img src="../
0
9480
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
10313
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
8968
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...
0
6735
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
5378
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.