function replaceSubstring(input, from, to) { // Goes through the input and replaces every occurrence of from with to //By droptchyald[dropt@bean-o.com] var output=''; while(input.length >= from.length && input.length > 0 && from.length > 0){ if(input.substring(0,from.length) == from){ output += to; input = input.substring(from.length); }else{ output += input.substring(0,1); input = input.substring(1); } } return output + input; } function replaceSubstring2(input, from, to) { // Goes through the input and replaces every occurrence of from with to //By droptchyald[dropt@bean-o.com] var output=''; var count=0; while(input.length >= from.length && input.length > 0 && from.length > 0){ if(input.substring(0,from.length) == from){ output += to; input = input.substring(from.length); }else{ output += input.substring(0,1); input = input.substring(1); } } output += input; if(count == 0) return output; return replaceSubstring(output, from, to); } function replaceSubstring3(text,expression,value){ //Uses regular expressions. This code was written for JavaScript 1.2+ browsers //Use the replaceSubstring or replaceSubstring2 functions if 1.0 & 1.1 browsers. // //replaceSubstring("hellothere","l","x") = "hexxothere" var exp = new RegExp(expression,'g') return text.replace(exp,value) } function replaceSubstring4(inputString, fromString, toString) { var tempString = inputString; for(var i=0;i