例如:
var s = "check this out <a href='http://www.google.com'>Click me</a>. cool,huh?";
我想使用正则表达式,所以我留下来:
s = "check this out. cool,huh?";
mystr = "check this out <a href='http://www.google.com'>Click me</a>. cool,huh?"; alert(mystr.replace(/<a\b[^>]*>(.*?)<\/a>/i,""));
这不是真的万无一失,但也许它会为你的目的做窍门…