码迷,mamicode.com
首页 > 其他好文 > 详细

写入cookie后只显示一次的DIV提示框代码

时间:2014-07-23 15:47:39      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:style   blog   java   color   os   io   

 

 

<script type="text/javascript">
function cookiesave(n, v, mins, dn, path){
    if(n)
    {
        
        if(!mins) mins = 365 * 24 * 60;
        if(!path) path = "/";
        var date = new Date();
        
        date.setTime(date.getTime() + (mins * 60 * 1000));
        
        var expires = "; expires=" + date.toGMTString();
        
        if(dn) dn = "domain=" + dn + "; ";
        document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path;
    }
}
function cookieget(n){
    var name = n + "=";
    var ca = document.cookie.split(;);
    for(var i=0;i<ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)== ) c = c.substring(1,c.length);
        if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
    }
    return "";
}
function closeclick(){
    document.getElementById(note).style.display=none;
    cookiesave(closeclick,closeclick,‘‘,‘‘,‘‘);
}
function clickclose(){
    if(cookieget(closeclick)==closeclick){
        document.getElementById(note).style.display=none;
    }else{
        document.getElementById(note).style.display=block;
    }
}
window.onload=clickclose;
</script>

写入cookie后只显示一次的DIV提示框代码,布布扣,bubuko.com

写入cookie后只显示一次的DIV提示框代码

标签:style   blog   java   color   os   io   

原文地址:http://www.cnblogs.com/xuxiaoshuan/p/3863058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!