outerHTML is an IE only property that only a few other browsers support. However, Mozilla's JavaScript implementation rocks so try this code I found on <http://webfx.eae.net/dhtml/ieemu/htmlmodel.html>:
var _emptyTags = { "IMG": true, "BR": true, "INPUT": true, "META": true, "LINK": true, "PARAM": true, "HR": true }; HTMLElement.prototype.__defineGetter__("outerHTML", function () { var attrs = this.attributes; var str = "<" + this.tagName; for (var i = 0; i < attrs.length; i++) str += " " + attrs[i].name + "=\"" + attrs[i].value + "\""; if (_emptyTags[this.tagName]) return str + ">"; return str + ">" + this.innerHTML + "</" + this.tagName + ">"; }); HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var df = r.createContextualFragment(sHTML); this.parentNode.replaceChild(df, this); }); That should allow you to get and set outerHTML like a regular variable. -blair bjb wrote:
Hi, I've some code that works fine with IE, but not on Firefox (2.0.0.3) on Vista: html: <code> <div id="k"> ... ... <img src="pic1"> </div> <script> i=0; alert($("#k img").get(i).outerHTML ); </script> </code> returns "undefined" in FF any ideas?