核心内容:
String.prototype.httpHtml = function(){
var reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g;
return this.replace(reg, '$1$2');
};
var v = "欢迎访问我的个人网站:http://www.zhangxinxu.com/";
alert(v.httpHtml());
详情请见:http://www.zhangxinxu.com/wordpress/2010/04/javascript实现http地址自动检测并添加url链接/
网友评论