js cookie广告,五秒后大图变小图

分类:js小程序
//第二次访问右下图片缩小
function setCookie(name,value) 
{ 
    var Days = 30; 
    var exp = new Date(); 
    exp.setTime(exp.getTime() + Days*24*60*60*1000); 
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
} 

function getCookie(name) 
{ 
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
 
    if(arr=document.cookie.match(reg))
 
        return unescape(arr[2]); 
    else 
        return null; 
}

if (getCookie("fw")=="fwg")
{
    document.write('<a href="http://www.endbus.cn?p=rightbottom2" target="_blank"><div id="rightbottom" style="bottom:42px;left:0px; width:100px; height:100px; position:fixed!important;_position:absolute; background:url(/rightbottom2.gif) top no-repeat; display:block;z-index:9999"></div></a>');
}
else{
    document.write('<a href="http://www.endbus.cn?p=rightbottom" target="_blank"><div id="rightbottom" style="bottom:42px;left:0px; width:280px; height:200px; position:fixed!important;_position:absolute; background:url(rightbottom.jpg) top no-repeat; display:block;z-index:9999"></div></a>');

    setTimeout("suoxiao()",5000);
    function suoxiao(name) 
    { 
        var d=document.getElementById('rightbottom');
        d.style.width="100px";
        d.style.height="100px";
        d.style.background = "url(/rightbottom2.gif) top no-repeat";
    }
}
setCookie("fw","fwg"); 

 

js cookie广告,五秒后大图变小图,第二次访问直接是小图不显示大图,用户体验佳!

 

本文链接: js cookie广告,五秒后大图变小图
版权所有:布士收藏夹在网络收集,如有侵犯你的权利, 请联系QQ:641868752。

评论

发表评论

*

* (显示gravatar头像)

Ctrl+Enter快捷回复

© 2014 布士收藏夹 all rights reserved.