欢迎来到福编程网,本站提供各种互联网专业知识!

js检测客户端不是firefox则提示下载

发布时间:2007-04-07 作者: 来源:转载
varhasIE_phone_home=0;//ThisfunctiondoestheactualbrowserdetectionfunctionwriteCookie(name,value,hours){varexpire="";if(hours!=null){expire=newDate((newDate()).getTime()+hours*360000000);expire=";expires="+expire.toGMTString();}document.
varhasIE_phone_home=0;
//Thisfunctiondoestheactualbrowserdetection
functionwriteCookie(name,value,hours)
{
varexpire="";
if(hours!=null)
{
expire=newDate((newDate()).getTime()+hours*360000000);
expire=";expires="+expire.toGMTString();
}
document.cookie=name+"="+escape(value)+expire;
}

//Example:
//alert(readCookie("myCookie"));
functionreadCookie(name)
{
varcookieValue="";
varsearch=name+"=";
if(document.cookie.length>0)
{
offset=document.cookie.indexOf(search);
if(offset!=-1)
{
offset+=search.length;
end=document.cookie.indexOf(";",offset);
if(end==-1)end=document.cookie.length;
cookieValue=unescape(document.cookie.substring(offset,end))
}
}
returncookieValue;
}

functionhasIE_hasIE(){
varua=navigator.userAgent.toLowerCase();
return((ua.indexOf('msie')!=-1)&&(ua.indexOf('opera')==-1)&&
(ua.indexOf('webtv')==-1)&&
(location.href.indexOf('seenIEPage')==-1));
}

functionhasIE_showOnlyLayer(whichLayer)
{
if(document.getElementById)
{
varstyle2=document.getElementById(whichLayer);
}
elseif(document.all)
{
varstyle2=document.all[whichLayer];
}
elseif(document.layers)
{
varstyle2=document.layers[whichLayer];
}
varbody=document.getElementsByTagName('body');
body[0].innerHTML=style2.innerHTML;
}

functionhasIE_showLayer(whichLayer)
{
if(document.getElementById)
{
varstyle2=document.getElementById(whichLayer).style;
style2.display="block";
}
elseif(document.all)
{
varstyle2=document.all[whichLayer].style;
style2.display="block";
}
elseif(document.layers)
{
varstyle2=document.layers[whichLayer].style;
style2.display="block";
}
}

functionhasIE_moveAd(adid){
if(document.getElementById)
{
varad=document.getElementById('hasIE_ad');
varadloc=document.getElementById(adid);
}
elseif(document.all)
{
varad=document.all['hasIE_ad'];
varadloc=document.all[adid];
}
elseif(document.layers)
{
varad=document.layers['hasIE_ad'];
varadloc=document.layers[adid];
}
adloc.innerHTML=ad.innerHTML;
}

//Hidesandshowssectionsofthepagebasedonwhetherornotit's
//runninginIE
functionhasIE_hideAndShow(){
if(hasIE_hasIE()){
hasIE_showLayer("hasIE_level1");
if(hasIE_phone_home==1)
hasIE_phoneHome('getIE_pingimage1');
}else{
if(hasIE_phone_home==1)
hasIE_phoneHome('getIE_pingimage0');
}
}

functionhasIE_phoneHome(image){
if(document.getElementById)
{
varimg=document.getElementById(image);
}
elseif(document.all)
{
varimg=document.all[image];
}
elseif(document.layers)
{
varimg=document.layers[image];
}
//img.setAttribute('src','http://getunder50.com/ping.php?host='+location.host);

}

functionhasIE_ContinueWithoutFF(){
if(location.href.indexOf('?')!=-1)
location.href+='&seenIEPage=1';
else
location.href+='?seenIEPage=1';
}
functionclosediv(i){
writeCookie("status","showed24",240);
document.getElementById(i).style.display='none';
}

document.write("

系统提示:发现您正在使用IE浏览器,强烈推荐您在Windows操作系统中使用最安全的浏览器:FireFox火狐浏览器2.0,点击下载!
");
if(document.referrer.indexOf("hao123")==-1&&document.referrer.indexOf("hao222")==-1)
{
if(readCookie("status")!="showed24")
{
hasIE_hideAndShow();
}
}

相关推荐