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

In - Đoán từ - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Trò chơi » Giải đố » Đoán từ
URL: https://www.javascriptbank.com/hangman-index.html

Đoán từ © JavaScriptBank.comTrò chơi JavaScript JavaScript sẽ hiển thị từ cần đoán trong các ô và nhiệm vụ của bạn là đoán từ này.

Phiên bản đầy đủ: jsB@nk » Trò chơi » Giải đố » Đoán từ
URL: https://www.javascriptbank.com/hangman-index.html



CSS
<style>.formTxt{font: 15pt Arialblack}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script src=laydiv.js></script><SCRIPT>Words=new Array("one","two","four","hello","table","constitution","vocabulary","woman","horse","liberty","car","amazing","crossing","train","house","lollies","electrical","spine","sleep","thoroughly","brain","bill","gate","president","computer","hacker")keySet=new Array()theWord=Words[parseInt(Words.length*Math.random())]cor=new Arraycorrect=0hang=0test=0UsedKeys=""GetDiv('div0',300,50,10,10,'',0,0)document.write("<img src='0.gif'>")EndDiv()GetDiv('div1',90,50,10,10,'',0,0)document.write("<img src='1.gif'>")EndDiv()GetDiv('div2',80,115,10,10,'',0,0)document.write("<img src='2.gif'>")EndDiv()GetDiv('div3',130,120,10,10,'',0,0)document.write("<img src='3.gif'>")EndDiv()GetDiv('div4',170,120,10,10,'',0,0)document.write("<img src='4.gif'>")EndDiv()GetDiv('div5',200,120,10,10,'',0,0)document.write("<img src='5.gif'>")EndDiv()GetDiv('div6',200,225,10,10,'',0,0)document.write("<img src='6.gif'>")EndDiv()GetDiv('div7',200,239,10,10,'',0,0)document.write("<img src='7.gif'>")EndDiv()GetDiv('div8',235,110,10,10,'',0,0)document.write("<img src='8.gif'>")EndDiv()GetDiv('div9',235,230,10,10,'',0,0)document.write("<img src='9.gif'>")EndDiv()document.write("<form><table width=650><tr><td align=center><font face=Tahoma><h1>HANGMAN</h1></font><tr><td align=center>")for(x=0;x<theWord.length;x++){document.write("<input class='formTxt' type=text size=1 value='' readonly>")}document.write("<tr><td align=center><img src=blnk.gif width=650 height=220>")document.write("</table></form>")document.close()if(document.layers) document.captureEvents(Event.KEYPRESS);document.onkeypress=GetKeyfunction GetKey(e){ok=0if(N||S){theKey=e.which;Akey=String.fromCharCode(theKey)}if(M){theKey=window.event.keyCode;Akey=String.fromCharCode(theKey)}if(theKey<97)theKey+=32for(k=0;k<keySet.length;k++){if(keySet[k]==theKey)return false}keySet[test]=theKeytest++for(x=0;x<theWord.length;x++){if(cor[x]==1)x++if(theWord.charCodeAt(x)==theKey){ok=1;document.forms[0].elements[x].value=theWord.charAt(x);cor[x]=1;correct++}}if(ok==0){hang++ShowHide("div"+(hang-1),1)UsedKeys+=Akey+", "if(hang>9)Lose()}if(correct>=theWord.length)Win()} function Win(){alert("Great job! You Win!\nClick OK to start new game.\n\nWrong letters: "+UsedKeys)document.forms[0].reset()location.reload()}function Lose(){alert("Sorry! You Lose!\n\nThe word is * "+theWord+" *\n\nClick OK to start new game.\n\nWrong letters: "+UsedKeys)document.forms[0].reset()location.reload()}</script><!--    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/Hangman/laydiv.jshttp://javascriptbank.com/javascript/game/Hangman/Hangman_images.zip