var fieldImage = document.createElement("img");
fieldImage.src = domObj.fieldImage;
I am trying to get the formatted string for: fieldImage like "<img
src="...."/>" but don't see a method to do that.
Ideas? Help!
fieldImage.outerHTML
is what IE 4 introduced and by now most browsers beside Mozilla browsers
offer.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
outerHTML will not yield the true source code, though. It will also not
work as expected with XHTML, which is what the OP might want (if the `/' in
the start tag is any indication). Fortunately, XML serializers are built-in
at least in Gecko:
var s = new XMLSerializer().serializeToString(
nodeRef, "application/xhtml+xml");
It is rather unclear why the OP would want the source code when he has the
object; however, if the built-in serializers are not satisfactory, it is
rather easy to create one (merely an exercise in string concatenation) as
the properties that need to be accessed are known (especially here as the OP
appears to assign them himself) and can be feature-tested. Only
transforming event-handler attributes back to string might prove a bit tricky.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
alert(fieldImage.outerHTML);
--
Jorge.