Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

outerHTML not working in Firefox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Kotuby - 27 Jun 2007 14:38 GMT
Hello all,

Maybe there is a better place to post this, but I'm not sure where.
I am writing a Web application. Using a pop-up for printing a portion of the
parent window, from an imbedded javascript function, I am using outerHTML to
grab that markup and then place it in the markup of the page displaying in
the pop-up.
Here is the script...

function setMyContent()
{
var theBody =
window.opener.document.getElementById("cardContent").outerHTML;
var theDivTag = document.getElementById("theCard");
theDivTag.innerHTML = theBody;
}
</script>

This all works fine in IE6 and IE7, but I am getting "undefined" returned in
Firefox.

Anyone know?

Thanks to all...
Alexey Smirnov - 27 Jun 2007 15:15 GMT
On Jun 27, 3:38 pm, "John Kotuby"
<JohnKot...@discussions.microsoft.com> wrote:
> Hello all,
>
[quoted text clipped - 20 lines]
>
> Thanks to all...

try to use this function

function getOuterHTML(object) {
     var element;
     if (!object) return null;
     element = document.createElement("div");
     element.appendChild(object.cloneNode(true));
     return element.innerHTML;
}
John Kotuby - 27 Jun 2007 16:38 GMT
Thanks Alexey...

> On Jun 27, 3:38 pm, "John Kotuby"
> <JohnKot...@discussions.microsoft.com> wrote:
[quoted text clipped - 36 lines]
>      return element.innerHTML;
> }
Mark Rae - 27 Jun 2007 16:40 GMT
> I am using outerHTML

According to Danny Goodman's "Dynamic HTML - The Definitive Reference",
outerHTML is supported in IE 4 and above, Safari 1.3 and above, and Opera 7
and above.

It is not supported in Netscape or Mozilla (i.e. FireFox)...

Signature

http://www.markrae.net

bruce barker - 27 Jun 2007 16:41 GMT
outerHTML is not a valid W3C dom property so is not supported by
firefox. firefox does support innerHTML even though its not a standard.

you should be using W3C properties like nodeValue (for innerHTML). you
can use the document.createNode() to clone the outernode (be sure to
copy attributes)

-- bruce (sqlwork.com)

> Hello all,
>
[quoted text clipped - 20 lines]
>
> Thanks to all...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.