»
EnglishFrenchVietnamese

Print - Match-flip - JavaScriptBank.com

Full version: jsB@nk » Game » Puzzle » Match-flip
URL: https://www.javascriptbank.com/flip-match-index.html

Match-flip © JavaScriptBank.comConcentration type game. Remember the flipped image and find it's matching twin.

Full version: jsB@nk » Game » Puzzle » Match-flip
URL: https://www.javascriptbank.com/flip-match-index.html



JavaScript
<script>self.moveTo(0,0)self.resizeTo(800,700)Intro=open('','Intro','fullscreen')Intro.document.write("<center><b>Please wait while page loads. Thanks...</b><p>")Pix=new Array()flip=new Array()for(x=0;x<16;x++){Pix[x]=new Image()Pix[x].src="Pic"+x+".jpg"Intro.document.write("<img src=",Pix[x].src," width=80 height=80>")if(x%8==0)Intro.document.write("<p>")Pix[x+16]=new Image()Pix[x+16].src="Pic"+x+".jpg"flip[x]=0}Intro.document.write("<p><a href='javascript:self.close()'>ENTER</a></center>")Intro.document.close()shuf=new Array()function Shuffle(){for(s=0;s<32;s++){ok=0while(ok==0){ok=1ran=Math.floor(32*Math.random())for(chk=0;chk<shuf.length;chk++){if(ran==shuf[chk]){ok=0}}}shuf[s]=ran}}clix=0guess=0 score=0function ClickOn(i){if(flip[i]==1) returnif(clix==0){document["Img"+i].src=Pix[shuf[i]].srcclix=1a=ireturn}if(clix==1){document["Img"+i].src=Pix[shuf[i]].srcb=iif(b==a){document["Img"+i].src='blnk.gif';clix=0;return}setTimeout('ChkMatch()',500)}}function ChkMatch(){clix=0if(Pix[shuf[a]].src==Pix[shuf[b]].src) {document.forms[0].narra.value="Yahoo!!! Its a MATCH !!!"flip[a]=1flip[b]=1score++if(score>15){alert("Yeah! You got them all!\nNumber of guess "+guess)self.close()}}else{guess++document.forms[0].narra.value="No match! Guess "+guessdocument["Img"+a].src='blnk.gif'document["Img"+b].src='blnk.gif'}a=100b=100return}function GiveUp(){for(x=0;x<32;x++){document["Img"+x].src=Pix[shuf[x]].src}}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body onload="Shuffle()"><table cellspacing=5 cellpadding=2 border=1><script>for(x=0;x<4;x++){document.write("<tr>")for(y=0;y<8;y++){document.write("<td><a href='javascript:ClickOn("+(8*x+y)+")'><img name='Img"+(8*x+y)+"' src=blnk.gif width=60 height=60></a>")}}</script><tr><td colspan=8 align=center><form><input type=text size=30 value="INSTRUCTIONS!!!" name=narra><br>Click one square and another. Score if you match the pictures... <br>Try remember where the images are...<br>If you&#39;re about to go crazy ...<br><input type=button value="Give up!" onclick="GiveUp()"><br><br><input type=button value="New Game" onclick="location.reload()"></form></table></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/game/Flip_Match/Flip_Match_images.zip