Advertisement
Guest User

Untitled

a guest
Nov 10th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function htmlreplace(a,b,element){
  2.  
  3.     var nodes = (!element) ? document.body.childNodes : element.childNodes;
  4.  
  5.     for(var n=0;n<nodes.length;++n){
  6.         if(nodes[n].nodeType==Node.TEXT_NODE){
  7.             nodes[n].textContent = nodes[n].textContent.replace(new RegExp(a,'gi'),b);
  8.         } else {
  9.             htmlreplace(a,b,nodes[n]);
  10.         }
  11.     }
  12. }
  13.  
  14. htmlreplace('[^ ]','g');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement