Ajax HTML to document


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function htmltocontext(source)
  2. {
  3. var dt = document.implementation.createDocumentType("html", "-//W3C//DTD HTML 4.01 Transitional//EN", "http://www.w3.org/TR/html4/loose.dtd");
  4. var doc = document.implementation.createDocument('','', dt);
  5. var html = doc.createElement('html');
  6. html.innerHTML = source;
  7. doc.appendChild(html);
  8. return doc;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.