# Getting (X)HTML of an element

**URL:** <https://forum.kirupa.com/t/getting-x-html-of-an-element/240910>\
**Category:** Uncategorized\
**Created:** [October 8, 2007, 7:30am UTC](https://forum.kirupa.com/t/getting-x-html-of-an-element/240910 "2007-10-08T07:30:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [October 8, 2007, 7:30am UTC](https://forum.kirupa.com/t/getting-x-html-of-an-element/240910/1 "2007-10-08T07:30:29Z")

</div>

Im trying to implement a Javascript in tandem with swfObject that passes the HTML that gets replaced to flash, and then flash is gonna parse it as XML (seeing as well-formed XHTML is XML anyway)

so i was using

```auto

var sourceXMLVar = document.getElementById("wines").parentNode.innerHTML;
sourceXMLVar = sourceXMLVar.replace(/"/g, "'");

```

and it works fine in Firefox. i had to strip out the double-quotes but once i pass the vars to flash and parse it as XML it works perfectly.

but for some reason when i get the innerHTML in IE 6 or 7 - its all messed up. for instance, all the tag names are capitilised, and all the attributes except for href dont have any double-quotes (eg, \<div class=“test”\> gets turned into \<DIV class=test\> )

so after lots of reading about UA’s, tag soup, xhtml with text/html mime types and so forth, im totally stumped…

is it possible in both IE and Firefox (or preferably as many browsers as possible), to use javascript to create a string that contains all the html contained in a specific element, say a div?
