首页 > 其他 > 详细

cookie

时间:2017-08-20 23:20:46      阅读:176      评论:0      收藏:0      [点我收藏+]
<script>
			window.onload=function(){
				var oMask=document.getElementById(‘mask‘);
				var oSearch=document.getElementById(‘searchTip‘);	
				var aStep=oSearch.getElementsByTagName(‘div‘);
			
				//读取cookie
				function getCookie(name)
				{
				    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); //正则匹配
				    if(arr=document.cookie.match(reg)){
				      return unescape(arr[2]);
				    }
				    else{
				     return null;
				    }
				} 
				var res = getCookie(‘name‘)
				
				//alert(res)
				if(res!="www.zidingzhi.com"){
					
					oMask.style.display=oSearch.style.display=aStep[0].style.display="block";
					
					for( var i=0; i<aStep.length; i++){
						(function(index){
							aStep[i].onclick=function(){
							this.style.display="none";
							if(index<aStep.length-1){
								aStep[index+1].style.display="block";
							 }
							 else if(index==aStep.length-1){
								oMask.style.display="none";
								this.style.display=oSearch.style.display="none";
							}
						 }
						})(i)	
					}
					
				//定义cookie
				var oDate=new Date();
				oDate.setDate(oDate.getDate()+30);
				document.cookie="name=www.zidingzhi.com;expires="+oDate;
				}
			}
		</script>

  

cookie

原文:http://www.cnblogs.com/freddyhuang/p/7401740.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!