replace specific link to ******* [closed]
using php or javascript or ajax how to replace specific link to *
http://www.google.com/. to http://www.****
I'm assuming you mean something like (in Javascript):
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
if (links[i].href == "http://www.google.com/") links[i].href = "http://www.blather.blorg/"
}
Tested and works on Firefox 3.
str_replace()
$text = str_replace('google.com', '***', $text);
Even if the question is very different: A short JS solution
text = text.split("google.com").join("***");
精彩评论