Hi,
I have this small function to replace characters so symbols can be properly displayed in a textarea. In one function it is called multiple times
The function that does this is
This method is working perfectly for windows ie/netscape and mac safari but for some reason on a mac IE I get the error "Invalid Character" and the line number indicates "var index;" line in the replace all function
Any help would be appreciated
Thanks,
malonep
I have this small function to replace characters so symbols can be properly displayed in a textarea. In one function it is called multiple times
Code:
comment = replaceAll(comment,'#','#');
comment = replaceAll(comment,'>','>');
comment = replaceAll(comment,'<','<');
comment = replaceAll(comment,':','?');
comment = replaceAll(comment,''','\'');
comment = replaceAll(comment,'%','%');
comment = replaceAll(comment,'-','-');
comment = replaceAll(comment,'/','//');
comment = replaceAll(comment,'"','"');
Code:
function replaceAll(str,old,to) {
var index;
var newstr;
newstr = str;
index = newstr.indexOf( old );
while ( index > -1 ) {
newstr = newstr.replace( old, to );
index = newstr.indexOf( old );
}
return newstr;
}
Any help would be appreciated
Thanks,
malonep