新手导航源代码js

window.onload=function(){
	var oMask=document.getElementById('mask');    
	var oSearch=document.getElementById('searchTip');    
	var aStep=oSearch.getElementsByTagName('div');    
	var aA=oSearch.getElementsByTagName('a');     
	var aClose=oSearch.getElementsByTagName('span');   
	//读取cookie
	var res=document.cookie.substring(5);
	alert(res);
	
	//如果没有cookie,执行以下动作
	if(res!="www.open.com.cn"){
		alert(res)
		//mask  父框 第一单元显示出来
		oMask.style.display=oSearch.style.display=aStep[0].style.display='block';
		
		//下一步按钮
		for( var i=0; i<aStep.length; i++){
			aA[i].index=i; //为每一个按钮增加一个index属性,为后面引用的
			aA[i].onclick=function(){
				this.parentNode.style.display="none";
				if(this.index< aStep.length-1){
					aStep[this.index+1].style.display="block";
				}
				else if( this.index==aStep.length-1){
					oMask.style.display=oSearch.style.display="none";
				}
			}	
		}
		//关闭按钮
		for(var i=0; i<aClose.length;i++){
			aClose[i].onclick=function(){
				oMask.style.display=oSearch.style.display="none";
			}
		}
		//添加cookie
		var oDate=new Date();
		oDate.setDate(oDate.getDate()+30);
		document.cookie="name=www.unll123.com;expires="+oDate;  //name名字随意
	}    
}   

转载于:https://my.oschina.net/sycbbb/blog/792211

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值