A simple small game to guess words. I forgot where I saw this game. I wrote it right before I went to bed. there was no good idea, and there was no pursuit of style or anything. I used the SESSION to work with AJAX, I forgot where I saw this game. I wrote it right before I went to bed,
There is no good idea, and there is no pursuit of style or anything,
The SESSION is used in combination with AJAX,
CAPTCHA farmers, for advice and guidance,
PS: No optimization. do not spray it,
Copy the local file to run the task,
Script function Ajax (recvType) {var aj = new Object (); aj. recvType = recvType? RecvType. toUpperCase (): 'html'; aj.tar getUrl = ''; aj. sendString = ''; aj. resultHandle = null; aj. createXMLHttpRequest = function () {var xmlHttp = false; if (window. XMLHttpRequest) {xmlHttp = new XMLHttpRequest ();} else if (window. activeXObject) {try {xmlHttp = new ActiveXObject ("Msxml2.XMLHTTP");} catch (error1) {try {xmlHttp = new ActiveXobject ("Microsoft. XMLHttp ") ;}catch (error2) {xmlHttp = false ;}}} Return xmlHttp;} aj. XMLHttpRequest = aj. createXMLHttpRequest (); aj. processHandle = function () {if (aj. XMLHttpRequest. readyState = 4) {if (aj. XMLHttpRequest. status = 200) {if (aj. recvType = "HTML") {aj. resultHandle (aj. XMLHttpRequest. responseText);} else if (aj. recvType = "XML") {aj. resultHandle (aj. XMLHttpRequest. responseXML) ;}}} aj. get = function (targetUrl, resultHandle) {aj.tar getUrl = targetUrl; if (resu LtHandle! = Null) {aj. XMLHttpRequest. onreadystatechange = aj. processHandle; aj. resultHandle = resultHandle;} if (window. XMLHttpRequest) {aj. XMLHttpRequest. open ("get", aj.tar getUrl); aj. XMLHttpRequest. send (null);} else {aj. XMLHttpRequest. open ("get", aj.tar getUrl, true); aj. XMLHttpRequest. send () ;}} return aj ;}script var ajax = Ajax (); function select (v) {document. getElementById (v ). style. display = 'none'; ajax. g Et ("guess. php? Op = ajax & k = "+ v, function (r) {var t = r. split ("|"); document. getElementById ('word '). innerHTML = t [0]; if (t [1] = 1) {document. getElementById ('select '). style. display = 'none'; document. getElementById ('result '). innerHTML = 'success';} else if (t [1] = 2) {document. getElementById ('select '). style. display = 'none'; document. getElementById ('result '). innerHTML = 'failed' ;}});} function check (v) {ajax. get ("guess. php? Op = start & k = "+ v, function (r) {window. location. href ="
";}) ;}Script
Easy: wrong 10
'; Echo'Normal: wrong 5
'; Echo'Hard: wrong 3
';} Else {// echo $ word; echo "a maximum of errors can be guessed". $ _ SESSION ['num']. "times"; echo"
"; Echo""; Echo output ($ guess_word); echo"
"; Echo'
'; Echo''; For ($ I = ord ('A'); $ I <= ord ('Z'); ++ $ I) {echo "\ n "; $ letter = chr ($ I); echo ''. $ letter. '';} echo'
'; Echo'
'; Echo'
'; Echo''; Echo'
'; Echo'
'; Echo 'restart';}?>
Sorry, there is no good idea, and there is no pursuit of style or something. The SESSION is used in combination with AJAX. I hope you can provide suggestions and guidance...