有多个域名指向同一个主机空间,要实现用 域名访问该网站的话,调用A.js,用 域名访问该网站的话,调用B.js,其他域名访问则调用C.js。
var str1=window.document.location.hostname;
if (str1=="")
{
document.writeln('
document.writeln('' + 'ipt>');
}
else if (str1=="")
{
document.writeln('
document.writeln('' + 'ipt>');
}
else
{
document.writeln('
document.writeln('' + 'ipt>');
}
---------------------------------
JS代码代码如下:
name=window.location.host;//获取玉米
name=name.toLowerCase()//将大写字母转换小写
if(name.indexOf("")>0)
document.write('广告代码1')
elseif(name.indexOf("")>0)
document.write('广告代码2')
else
document.write('广告代码3')