Forum Moderators: open

Message Too Old, No Replies

Inserting HTML code into an IFRAME

         

richmc

11:50 am on Jan 16, 2003 (gmt 0)

10+ Year Member



I'm trying to adapt a script to run as an on-page webpage editor.

The script gives a hotmail/yahoo style richtext interface, and allows you to toggle between HTML code and webpage view for editing.

My problem is as it stands the script only displays either:

HTML code from just after teh BODY tag to just before the closing BODY tag - uses the InnerHTML DOM attribute to pull this.

or

HTML code from just before the BODY tag to just after - using the OuterHTML DOM attribute

does anyone know a way of getting it to display the ENTIRE HTML, from HTML tag to closing tag?

I'm stumped!

richmc

12:15 pm on Jan 16, 2003 (gmt 0)

10+ Year Member



looking at the script in more detail it appears to be because of this code:


function setMode(bMode) {
var sTmp;
isHTMLMode = bMode;
if (isHTMLMode) {
sTmp=idContent.document.body.outerHTML;
idContent.document.body.innerText=sTmp;
} else {
sTmp=idContent.document.body.innerText;
idContent.document.body.outerHTML=sTmp;
}
idContent.focus();
}

where document.body is limiting the HTML i can pull from the page to what is between the BODY tags either including or not including the BODY tags depending on whether innerHTML or outerHTML is used.

I'm aware there is a document.all property but this doesn't seem to work!

Any ideas :-¦

andreasfriedrich

12:56 pm on Jan 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



idContent.document.
html
.outerHTML;
?

richmc

1:01 pm on Jan 16, 2003 (gmt 0)

10+ Year Member



sure i tried that about an hour ago - i'll give it another shot

richmc

1:06 pm on Jan 16, 2003 (gmt 0)

10+ Year Member



nope html is not a valid property