Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // removing the scripts to avoid any 'Permission Denied' errors in IE
- var cleaned = html.replace(/<script(.|s)*?/script>/g, "");
- // IE is stricter on malformed HTML injecting direct into DOM. By injecting into
- // an element that's not yet part of DOM it's more lenient and will clean it up.
- if (jQuery.browser.msie)
- {
- var tempElement = document.createElement("DIV");
- tempElement.innerHTML = cleaned;
- cleaned = tempElement.innerHTML;
- tempElement = null;
- }
- // now 'cleaned' is ready to use...
- replaceInReadOnly(document.getElementById("links"), "<a href>........etc</a>");
- function replaceInReadOnly(element, content){
- var newNode = document.createElement();
- newNode.innerHTML = content;
- var oldNode = element.firstChild;
- var output = element.replaceChild(newNode, oldNode);
- }
Add Comment
Please, Sign In to add comment