最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js 验证url 是否正确
时间:2010-09-12 编辑:简简单单 来源:一聚教程网
本文章提供一款完美的 js 验证url 是否正确代码,他可以验证现在所有域名,如cc,hk,me,pro等url正则验证表达式函数。
function isvalidurl( chars ) {
// chars = chars.replace(',',"");
//var re=/^([hh][tt]{2}[pp]://|[hh][tt]{2}[pp][ss]://)((((w+(-*w*)+).)+((com)|(net)|(edu)|(gov)|(org)|(biz)|(aero)|(coop)|(info)|(name)|(pro)|(museum))(.([a-z]{2}))?)|((w+(-*w*)+).(cn)))$/;
var re=/^([hh][tt]{2}[pp]://|[hh][tt]{2}[pp][ss]://)(s+.s+)$/;
//var re=/^([hh][tt]{2}[pp]://|[hh][tt]{2}[pp][ss]://)(((((w+(-*w*)+).)+((com)|(net)|(edu)|(gov)|(org)|(biz)|(aero)|(coop)|(info)|(name)|(pro)|(me)|(cc)|(museum)|(cn)|(tv)|(hk))(.([a-z]{2}))?)|((w+(-*w*)+).(cn)))((/|?)s*)*)$/;
if (!isnull(chars)) {
chars = jstrim(chars);
if (chars.match(re) == null)
return false;
else
return true;
}
return false;
}
-
上一个: 一款实用的js邮箱验证代码
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31