/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function htmltocontext(source) { var dt = document.implementation.createDocumentType("html", "-//W3C//DTD HTML 4.01 Transitional//EN", "http://www.w3.org/TR/html4/loose.dtd"); var doc = document.implementation.createDocument('','', dt); var html = doc.createElement('html'); html.innerHTML = source; doc.appendChild(html); return doc; }