vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > Switch-It

Switch-It - Posted By Marc (cr0w) on 17th Feb 08 at 7:41pm
Description: This code simply replaces any one word/phrase with any other word/phrase. This is good when needing to replace things longer than the censored words list will allow. {Smile}

Placement: Any footer, depending on what it's needed for.

How To Use: Simply repeat the switchIt() line for each thing that needs replacing. {Smile}

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Switch-It by Cr0w */
  4. function switchIt(word,word2){
  5.     var f = document.getElementsByTagName("font");
  6.     for(i=0;i<f.length;i++){
  7.         f[i].innerHTML = f[i].innerHTML.replace(word,word2);
  8.     }
  9. }
  10.  
  11. switchIt("WORD TO REPLACE","REPLACEMENT");
  12. //-->
  13. </script>