为了账号安全,请及时绑定邮箱和手机立即绑定

问下大佬,为什么没效果!!JavaScript代码加了之后没什么效果

.mask{
	height: 100%;
	width: 100%;
	background: #000;
	position: absolute;
	top: 0;
	left: 0;
	opacity: 0.5;/*火狐、谷歌*/
	filter: alpha(opacity=50);/*ie*/
	display: none;
}
.searchTip{
	width: 1220px;
	height: 800px;
	position: absolute;
	top: 0;
	left: 50%;
	margin-left: -580px;
	display: none;
}
.searchTip div{
	position: absolute;
	display: none;
}
.searchTip div a{
	position: absolute;
	/*隐藏文字*/
	text-indent: -999px;
	overflow: hidden;
	cursor: pointer;
}
.searchTip div span{
	position: absolute;
	text-indent: -999px;
	overflow: hidden;
	cursor: pointer;
	height: 30px;
	width: 30px;
}
.stepA{
	width: 800px;
	height: 518px;
	background: url(image/stepA_1.png) no-repeat;
	left: 16px;
	top: 109px;
}
.stepA a{
	top: 150px;
	left: 470px;
	width: 80px;
	height: 65px;
} 
.stepA span{
	left: 95px;
	top: 88px;
}
.stepB{
	width: 800px;
	height: 352px;
	background: url(image/stepB_1.png);
	top: 275px;
	left: 5px;
}
.stepB a{
	top: 110px;
	left: 590px;
	width: 100px;
	height: 65px;
}
.stepB span{
	left: 320px;
	top: 66px;
}
.stepC{
	width: 800px;
	height: 321px;
	background: url(image/stepC_1.png);
	top: 315px;
	left: 0;
}
.stepC a{
	top: 180px;
	left: 500px;
	width: 70px;
	height: 50px;
}
.stepC span{
	top: 148px;
	left: 298px;
}
.stepD{
	width: 800px;
	height: 540px;
	background: url(image/stepD_1.png);
	top: 156px;
	left: 5px;
}
.stepD a{
	top: 320px;
	left: 600px;
	width: 105px;
	height: 60px;
}
.stepD span{
	top: 253px;
	left: 262px;
}
.stepE{
	width: 800px;
	height: 488px;
	background: url(image/stepE_1.png);
	top: 157px;
	left: 418px;
}
.stepE a{
	top: 275px;
	left: 440px;
	width: 100px;
	height: 60px;
}
.stepE span{
	left: 94px;
	top: 200px;
}
	<script>
		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);//30天后失效
				document.cookie="name=www.open.com.cn;expires="+oDate;
			}
	
			
			
}
	</script>


正在回答

举报

0/150
提交
取消
如何实现“新手引导”效果
  • 参与学习       46275    人
  • 解答问题       189    个

学会用 原生JavaScript代码和JQuery两种方式实现依次显示效果

进入课程

问下大佬,为什么没效果!!JavaScript代码加了之后没什么效果

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号