连连看小程序

连连看小程序

ID:42684680

大小:15.05 KB

页数:8页

时间:2019-09-20

连连看小程序_第1页
连连看小程序_第2页
连连看小程序_第3页
连连看小程序_第4页
连连看小程序_第5页
资源描述:

《连连看小程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、varwidth=11;varheight=10;varlinkStack=null;varlock=false;varnumbers=42;vartimeCount=90;varenableTimer=true;vartimer=null;varlose=false;functioncreateCanvas(_width,_height){for(vari=2;i<_width-2;i++){for(varj=2;j<_height-2;j++){varsquareId="ele"+(i-1)+"_"+

2、(j-1);varsquareObj=document.getElementById(squareId);squareObj.style.backgroundImage="url(img/"+points[i][j].value+".png)";squareObj.onclick=eleChoose;}}}functioneleChoose(_event){if(lose)return;if(lock)return;lock=true;varevent;varp;varpath;if(window.eve

3、nt){event=window.event;p=getPoint(event.srcElement.getAttribute("id"));}else{event=_event;p=getPoint(event.target.getAttribute("id"));}if(linkStack.length==0){choose(p);linkStack.push(p);}else{if(p.x==linkStack[0].x&&p.y==linkStack[0].y){unchoose(linkStac

4、k.pop());lock=false;return;}choose(p);if(p.value==linkStack[0].value){path=linkPoints(linkStack[0],p);if(path){for(vari=0;i

5、

6、path[i].x>8

7、

8、path[i].y<2

9、

10、path[i].y>7){unchoose(linkStack.pop());linkStack.push(p);lock=false;retu

11、rn;}}unchoose(linkStack.pop());unchoose(p);linkSus(path);}else{path=linkPoints(p,linkStack[0]);if(path){for(vari=0;i

12、

13、path[i].x>8

14、

15、path[i].y<2

16、

17、path[i].y>7){unchoose(linkStack.pop());linkStack.push(p);lock=false;return;}}un

18、choose(linkStack.pop());unchoose(p);linkSus(path);}else{unchoose(linkStack.pop());linkStack.push(p);}}}else{unchoose(linkStack.pop());linkStack.push(p);}}lock=false;}functionchoose(_point){varsquareId="ele"+(_point.x-1)+"_"+(_point.y-1);varsquareObj=docum

19、ent.getElementById(squareId);squareObj.style.backgroundImage="url(img/"+_point.value+"-2.png)";//setTimeout(unchoose,200,_point);//setTimeout(blink,300,_point);}functionunchoose(_point){varsquareId="ele"+(_point.x-1)+"_"+(_point.y-1);varsquareObj=document

20、.getElementById(squareId);squareObj.style.backgroundImage="url(img/"+_point.value+".png)";}functionblink(_point){varsquareId="ele"+(_point.x-1)+"_"+(_point.y-1);varsquareObj=document.getElementById(squareId);squareO

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。