js 获取域名
function gethost(url){
if(url==null || url==""){
return "";
}
var regex = /.*://([^/]*).*/;
var match = url.match(regex);
if(typeof match != "undefined" && null != match)
{
host = match[1];
}
return host;
}
时间: 2024-11-13 07:28:36