Hey everyone, im wondering how I would go about doing the equivelant of preg_replace, in javascript basicallyt i wanna set something up so that if someone comes across the word "cat" on my site, it changes it to "kitty" or something along those lines. help please?
var str=document.body.innerHTML document.write(str.replace(/cat/, "kitty")) thats what ive tried so far... but it doesnt seem to be working
var str=document.body.whole document.write(str.replace(/cat/, "kitty")) i cant get this to work... ahhh
what do you mean "it doesn't work"? Gives you an error? (if you have Firefox, have you checked the Error Console?) Doesn't do anything? Also, can you please show more of your script and/or give us the URL - as your code seems fine to me...