标签:length 域名 方法 com ref window nbsp style win
方法一
var hrefValue = window.location.href;
alertUrls = [‘abc.com‘, ‘edf.com‘];
for(key in alertUrls){
if(String(hrefValue).indexOf(alertUrls[key]) >= 0){
break;
}else{
}
}
方法二
function tiaozhuan()
{
hrefValue = window.location.href; //获取当前页面的地址
var alrUrls = [‘sm.abc.com‘, ‘3g.abv.com‘, ‘m.abc.com‘];
for(var i=0;i<=altUrls.length;i++)
{
if(String(hrefValue).indexOf(altUrls[i]) >= 0)
{
if(altUrls[i]=="sm.hkzhifa.com")
{
//break;
}
else if(altUrls[i]=="3g.hkzhifa.com")
{
//break;
}
else{
}
}
}
}
获取当前网址并跳转多个域名
标签:length 域名 方法 com ref window nbsp style win
原文地址:http://www.cnblogs.com/hilxj/p/7399192.html