»
Tiếng AnhTiếng PhápTiếng Việt

In - Thử tài trí nhớ - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Trò chơi » Giải đố » Thử tài trí nhớ
URL: https://www.javascriptbank.com/face-memory-index.html

Thử tài trí nhớ © JavaScriptBank.comTrò chơi JavaScript JavaScript sẽ cho bạn xem hình mẫu lúc đầu và sau đó nhiệm vụ của bạn là vẽ lại hình mẫu đó theo trí nhớ.

Phiên bản đầy đủ: jsB@nk » Trò chơi » Giải đố » Thử tài trí nhớ
URL: https://www.javascriptbank.com/face-memory-index.html



JavaScript
<script>HelpLine="This game tests your skill in remembering facies\n"HelpLine+="It first provides you with a face.\n"HelpLine+="You have to remember how the hair looks, the shape of eyes, mouth, etc,...\n"HelpLine+="Then try to reconstruct that face using the button\n"HelpLine+="Keep clicking the same buttons to go through all teh possible combinations\n"HelpLine+="It's not that easy, but anyhow, have a go!\n"</script><script>Pieces=new Array()Crim=new Array()Yours=new Array()FaceOf=new Array("This is the Face","This is your sketch")function Init(){document.Form.Okbtn.value="READY"document.Form.Notes.value="This is the Face\nPlease memorise it\nthen click READY"Score=0for(x=0;x<10;x++){document.Form.elements[x].value=""Pieces[x]=document.Form.elements[x].nameCrim[x]=Math.ceil(Math.random()*3)document.images[Pieces[x]].src=Pieces[x]+Crim[x]+".gif"}}function GetFace(Imgid){if(document.Form.Okbtn.value!="OKAY")returnImgSrc=document[Imgid].srcn=parseInt(ImgSrc.substr(ImgSrc.indexOf(".gif")-1,1))n=(n<3)?n+1:1document[Imgid].src=Imgid+n+".gif"document.Form[Imgid].value=n}function OKbutton(com){if(com=="READY"){document.Form.Okbtn.value="OKAY"document.Form.Notes.value="Now try rebuild the old Face\nby clicking the buttons\nClick OKAY when finish"for(x=0;x<10;x++){document[Pieces[x]].src="blnk.gif"document.Form.elements[x].value="?"}}if(com=="OKAY"){document.Form.Okbtn.value="NEW"for(x=0;x<10;x++){Yours[x]=(document.Form.elements[x].value=="?")?0:document.Form.elements[x].valueif(Yours[x]==Crim[x])Score++}document.Form.Notes.value="Score :"+Scoreface=0Flik=setInterval('Faces()',1500)}if(com=="NEW") {clearInterval(Flik)Init()}}function Faces(){face=(face==0)?1:0A=(face==1)?Yours:Crimdocument.Form.Notes.value="Score :"+Score+"\n"+FaceOf[face]for(x=0;x<10;x++){Pix=(A[x]>0)?Pieces[x]+A[x]+".gif":"blnk.gif"document[Pieces[x]].src=Pix}}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body onload=Init()><table bgcolor=silver cellspacing=0 cellpadding=0 border=0><tr><td>I<td width=40 align=center>D<td width=40 align=center>E<td width=40 align=center>N<td width=40 align=center>T<td width=40 align=center>I<td width=40 align=center>X        <tr><td align=right>D<td valign=top rowspan=6> <img src=hairL1.gif width=40 height=120 border=0 name=hairL></td><td colspan=4>   <img src=hairM1.gif width=160 height=40 border=0 name=hairM></td><td valign=top rowspan=6>     <img src=hairR1.gif width=40 height=120 border=0 name=hairR></td></tr><tr><td align=right>E<td colspan=2>     <img src=eyeL1.gif width=80 height=40 border=0 name=eyeL></td><td colspan=2>     <img src=eyeR1.gif width=80 height=40 border=0 name=eyeR></td></tr><tr> <td align=right>N         <td  rowspan=4 valign=top>    <img src=cheekL1.gif width=40 height=120 border=0 name=cheekL></td><td colspan=2 rowspan=2><img src=nose1.gif width=80 height=80 border=0 name=nose></td><td  rowspan=4 valign=top>     <img src=cheekR1.gif width=40 height=120 border=0 name=cheekR></td></tr>                  <tr><td align=right>T<tr><td align=right>I<td  colspan=2>  <img src=mouth1.gif width=80 height=40 border=0 name=mouth></td></tr><tr> <td align=right>X             <td colspan=2>     <img src=chin1.gif width=80 height=40 border=0 name=chin></td></tr>      </table><form name=Form><table border=1><tr><td><input  type=button style="width:20" width=20  name="hairL" onclick=GetFace("hairL")><td><input  type=button style="width:20" width=20  name="hairM" onclick=GetFace("hairM")><td><input  type=button style="width:20" width=20  name="hairR" onclick=GetFace("hairR")><td><input  type=button style="width:20" width=20  name="eyeL" onclick=GetFace("eyeL")><td><input  type=button style="width:20" width=20  name="nose" onclick=GetFace("nose")><td><input  type=button style="width:20" width=20  name="eyeR" onclick=GetFace("eyeR")><td><input  type=button style="width:20" width=20  name="cheekL" onclick=GetFace("cheekL")><td><input  type=button style="width:20" width=20  name="mouth" onclick=GetFace("mouth")><td><input  type=button style="width:20" width=20  name="cheekR" onclick=GetFace("cheekR")><td><input  type=button style="width:20" width=20  name="chin" onclick=GetFace("chin")><tr><td colspan=10 align=center><textarea cols=30 rows=3 wrap=yes name=Notes></textarea><tr><td colspan=3><input type=button  style="width:70" width=70 value="Help" onclick="alert(HelpLine)"><td colspan=4 align=center><input type=button name=Okbtn value="READY" style="width:70" width=70 onclick=OKbutton(this.value)><td colspan=3 align=right><input type=button  style="width:70" width=70 value="Contact" onclick="location='http://jsbank.scripterz.org'"></table></form></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/Face_Memory/Face_Memory_images.zip