MS added the outerHTML
and innerHTML
properties some time ago.(MS不久前添加了outerHTML
和innerHTML
属性。)
According to MDN , outerHTML
is supported in Firefox 11, Chrome 0.2, Internet Explorer 4.0, Opera 7, Safari 1.3, Android, Firefox Mobile 11, IE Mobile, Opera Mobile, and Safari Mobile.(根据MDN , outerHTML
是在Firefox 11,Chrome浏览器0.2,Internet浏览器4.0,歌剧7,Safari浏览器1.3,安卓,Firefox移动11,IE移动,Opera移动,和Safari移动的支持。)
outerHTML
is in the DOM Parsing and Serialization specification.(outerHTML
在DOM解析和序列化规范中。)
See quirksmode for browser compatibility for what will work for you.(有关适合您的浏览器的兼容性,请参见quirksmode 。)
All support innerHTML
.(所有都支持innerHTML
。)
var markup = document.documentElement.innerHTML;
alert(markup);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…