473,723 Members | 2,211 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 3417

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
11268
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
4215
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
13305
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
4067
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
2303
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
3542
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
6457
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
2626
by: Prasad | last post by:
Hi , I am using a cross domain iframe in my page.. If i want to change the iframe height a/c to its content height , its giving Permission denied error as i am trying to access a function, which changes an iframe's height, in the parent window ... So Is there any way to change its height from the iframe itself???????
3
7352
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
8868
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
8741
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
9241
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...
1
9160
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
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...
1
6685
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3209
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
3
2149
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.