<--- --------------------------------------------------------------------------------------- ---- Blog Entry: Ask Ben: Javascript String Replace Method Author: Ben Nadel / Kinky Solutions Link: http://www.bennadel.com/index.cfm?dax=blog:142.view Date Posted: Jul 17, 2006 at 7:36 AM ---- --------------------------------------------------------------------------------------- ---> var strReplaceAll = strText; var intIndexOfMatch = strReplaceAll.indexOf( "th" ); // Loop over the string value replacing out each matching // substring. while (intIndexOfMatch != -1){ // Relace out the current instance. strReplaceAll = strReplaceAll.replace( "th", "[X]" ) // Get the index of any next matching substring. intIndexOfMatch = strReplaceAll.indexOf( "th" ); } alert( strReplaceAll );