JavaScript DHTML/Page Components/Game

Материал из Web эксперт
Перейти к: навигация, поиск

A JavaScript Hangman Game

   <source lang="html4strict">

/* Mastering JavaScript, Premium Edition by James Jaworski ISBN:078212819X Publisher Sybex CopyRight 2001

  • /

<HTML> <HEAD> <TITLE>Hangman</TITLE> <SCRIPT LANGUAGE="JavaScript"></SCRIPT> </HEAD> <BODY>

Hangman

<FORM NAME="game">

<TEXTAREA NAME="status" ROWS="7" COLS="16"
 ONFOCUS="stayAway()"></TEXTAREA>

<INPUT TYPE="TEXT" NAME="toGuess"

ONFOCUS="stayAway()"> Word to guess

<INPUT TYPE="TEXT" NAME="guessed"

ONFOCUS="stayAway()"> Letters guessed so far
<P>Enter your next guess.

<INPUT TYPE="BUTTON" VALUE=" A " ONCLICK="guess("A")"> <INPUT TYPE="BUTTON" VALUE=" B " ONCLICK="guess("B")"> <INPUT TYPE="BUTTON" VALUE=" C " ONCLICK="guess("C")"> <INPUT TYPE="BUTTON" VALUE=" D " ONCLICK="guess("D")"> <INPUT TYPE="BUTTON" VALUE=" E " ONCLICK="guess("E")"> <INPUT TYPE="BUTTON" VALUE=" F " ONCLICK="guess("F")"> <INPUT TYPE="BUTTON" VALUE=" G " ONCLICK="guess("G")"> <INPUT TYPE="BUTTON" VALUE=" H " ONCLICK="guess("H")"> <INPUT TYPE="BUTTON" VALUE=" I " ONCLICK="guess("I")"> <INPUT TYPE="BUTTON" VALUE=" J " ONCLICK="guess("J")"> <INPUT TYPE="BUTTON" VALUE=" K " ONCLICK="guess("K")"> <INPUT TYPE="BUTTON" VALUE=" L " ONCLICK="guess("L")"> <INPUT TYPE="BUTTON" VALUE=" M " ONCLICK="guess("M")"> <INPUT TYPE="BUTTON" VALUE=" N " ONCLICK="guess("N")"> <INPUT TYPE="BUTTON" VALUE=" O " ONCLICK="guess("O")"> <INPUT TYPE="BUTTON" VALUE=" P " ONCLICK="guess("P")"> <INPUT TYPE="BUTTON" VALUE=" Q " ONCLICK="guess("Q")"> <INPUT TYPE="BUTTON" VALUE=" R " ONCLICK="guess("R")"> <INPUT TYPE="BUTTON" VALUE=" S " ONCLICK="guess("S")"> <INPUT TYPE="BUTTON" VALUE=" T " ONCLICK="guess("T")"> <INPUT TYPE="BUTTON" VALUE=" U " ONCLICK="guess("U")"> <INPUT TYPE="BUTTON" VALUE=" V " ONCLICK="guess("V")"> <INPUT TYPE="BUTTON" VALUE=" W " ONCLICK="guess("W")"> <INPUT TYPE="BUTTON" VALUE=" X " ONCLICK="guess("X")"> <INPUT TYPE="BUTTON" VALUE=" Y " ONCLICK="guess("Y")">

<INPUT TYPE="BUTTON" VALUE=" Z " ONCLICK="guess("Z")">

<INPUT TYPE="BUTTON" NAME="restart" VALUE="---- Start Again ----" ONCLICK="startAgain()"> <SCRIPT LANGUAGE="JavaScript"></SCRIPT> </FORM> </BODY> </HTML> </source>

Another tictactoe

   <source lang="html4strict">


<html> <head> <title>!!! JS Games :: Tic-Tac-Toe !!!</title> <style> body,h1,h2,h3,.msg,td {font-family:Verdana,Comic Sans MS,Arial;} body {margin:0px;} h1 {font-size:28pt; font-weight:bold; margin-bottom:0px;} h2,.h2 {font-size:22pt; margin:0px; font-weight:bold; padding:0px;} h3 {font-size:8pt; margin:0px; font-weight:bold;} .cell {width:54px; height:60px; border:3px solid #999999; font-size:32pt; font-weight:bold;

      background-color:#606060; color:#ffffff;}

.tab {border:3px solid #999999; background-color:#999999;} .msg {font-size:8pt; font-weight:bold;} .tab {cursor:hand;} .board {font-size:9pt; font-weight:bold;} .status {font-size:9pt; font-weight:bold; color:#99ff99;} .progress {font-size:8pt; font-weight:bold;} .success {font-size:14pt; font-weight:bold; color:#33ccff;} .bnote {font-size:8pt; font-weight:normal;color:white;} a.notelnk,a.notelnk:visited,a.notelnk:active {font-size:8pt; font-weight:normal; color:#66ffcc;} .bnotehead {font-size:10pt; font-weight:bold;color:#66ffcc;} .email {font-size:8pt; font-weight:bold; color:white;} .but {font-size:8pt; font-weight:bold; height:24px; background-color:#606060; background-image:url(images/butbase.gif);

     border:0px solid #cccccc; border-left:none; border-right:none; color:white;}

.fra {border:2px solid #999999; background-color:#606060;} .clsThisGame, .clsBar {font-size:8pt; font-weight:bold; color:#cccccc;} .clsBar {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff;} .clsOtherGame {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff; text-decoration:none;} .help {font-size:8pt; margin:0px; font-weight:bold;} .menubar {padding:0px; margin:0px; brder-top:1px solid white; brder-bottom:1px solid white; background-color:#606060;

         background-image:url(images/menu.gif);}

</style> <script> var gtarget, ghi, gtries, gtime, gintervalid=-1; function toggleHelp() {

 if (butHelp.value == "Hide Help")
 {
   help.style.display = "none";
   butHelp.value = "Show Help";
 }
 else
 {
   help.style.display = "";
   butHelp.value = "Hide Help";
 }  

} /*

 0 1 2

0|-----| 1| | 2|_____|

  • /

var gcoords = new Array( "000102", "101112", "202122", "001020", "011121", "021222", "001122", "021120" ); //random number between low and hi function r(low,hi) {

 return Math.floor((hi-low)*Math.random()+low); 

} //random number between 0 and hi function r0(hi) {

 return Math.floor((hi)*Math.random()); 

} //random number between 1 and hi function r1(hi) {

 return Math.floor((hi-1)*Math.random()+1); 

} function showMessage(msgstr,classname) {

 if (classname != null)
   fldStatus.innerHTML = "" + msgstr + "";
 else
   fldStatus.innerHTML = msgstr;

} function stopGame() {

 clearInterval(gintervalid);
 gintervalid=-1;

} function isMarked(obj) {

 if (obj.innerHTML == "")
   return false;
 else
   return true;

} function markCell(obj,symbol) {

 obj.innerHTML = symbol;

} function getCell(row,col) {

 return eval("a_" + row + "_" + col);

} function getMark(obj) {

 return obj.innerHTML;

} function getMark(row,col) {

 return getCell(row,col).innerHTML;

} function getMarkSpace(row,col) {

 var r = getCell(row,col).innerHTML;
 if (r=="") r = " ";
 return r;

} function drawBoard() {

 var s, i, j;
 
s = "\n"; for (i=0;i<3;i++) { s += "\n"; for (j=0;j<3;j++) s += "\n"; s += "\n"; } s += "
";
 board.innerHTML = s;

} function toArray(coords) {

 var arr = new Array();
 
 for (var i=0;i<6;i++)
 {
   arr[i] = parseInt(coords.substr(i,1));
 }
 return arr;

} //Returns the blank cell in the first line where two cells are //already filled with "X" or "O". Returns null if match not found function getTwoInLineCell(symbol) {

 var s, arr;
 for (var i=0;i<gcoords.length;i++)
 {
   s = getLine(gcoords[i]);
   arr = toArray(gcoords[i]);
   if ( (symbol=="X" && s=="XX ") || (symbol=="O" && s=="OO ") )
     return getCell(arr[4],arr[5]);
   if ( (symbol=="X" && s=="X X") || (symbol=="O" && s=="O O") )
     return getCell(arr[2],arr[3]);
   if ( (symbol=="X" && s==" XX") || (symbol=="O" && s==" OO") )    
     return getCell(arr[0],arr[1]);
 }
 return null;

} //Returns a blank cell (random) in the first line where one cell //is already filled with "X" or "O" and the other two are blank. //Returns null if no such match is found function getOneInLineCell(symbol) {

 var s, arr;
 for (var i=0;i<gcoords.length;i++)
 {
   s = getLine(gcoords[i]);
   arr = toArray(gcoords[i]);
   if ( (symbol=="X" && s=="X  ") || (symbol=="O" && s=="O  ") ) 
     return (r0(2)==0) ? getCell(arr[2],arr[3]) : getCell(arr[4],arr[5]);
   if ( (symbol=="X" && s=="  X") || (symbol=="O" && s=="  O") ) 
     return (r0(2)==0) ? getCell(arr[2],arr[3]) : getCell(arr[0],arr[1]);    
   if ( (symbol=="X" && s==" X ") || (symbol=="O" && s==" O ") ) 
     return (r0(2)==0) ? getCell(arr[0],arr[1]) : getCell(arr[4],arr[5]);    
 }
 return null;

} function getRandomFreeCell() {

 var i,j,row=new Array(),col=new Array(),c=-1,n;
 if (getMark(1,1)=="") return getCell(1,1);
 
 for (i=0; i<3; i++)
 {
   for (j=0; j<3; j++)
   {
     if (getMark(i,j)=="")
     {
       c++;
       row[c] = i;
       col[c] = j;
     }
   }
 }
 if (c == -1) return null;
 
 n = r0(c+1);
 return getCell(row[n],col[n]);

} function getLine(coords) {

 var a = toArray(coords);
 return getMarkSpace(a[0],a[1]) + getMarkSpace(a[2],a[3]) + getMarkSpace(a[4],a[5]);

} function isGameOver() {

 var s;
 
 for (var i=0;i<gcoords.length;i++)
 {
   s = getLine(gcoords[i]);
   if (s=="XXX")
   {
     showMessage("Game Over! You have won it!
Time Taken: " + gtime + " secs","success"); stopGame(); return true; } if (s=="OOO") { showMessage("Game Over! Sorry, you have lost it!
Time Taken: " + gtime + " secs","success"); stopGame(); return true; } } return false;

} function draw(obj) {

 var cell;
 
 if (gintervalid == -1)
 {
   alert("Please press the \"Start Game\" button to start a new game.");
   return;
 }
 if (isMarked(obj)) return; //exit if already marked
 
 markCell(obj,"X");
 if (isGameOver()) return;
 
 cell = getTwoInLineCell("O");
 if (cell != null) //found two O"s and a blank in a line
 {
   markCell(cell,"O");
   if (isGameOver()) return; //always returns!
 }
 
 cell = getTwoInLineCell("X");
 if (cell != null) //found two X"s and a blank in a line; block it!
 {
   markCell(cell,"O");
   return;
 }
 
 cell = getOneInLineCell("O");
 if (cell != null)
 {
   markCell(cell,"O");
   return;
 }
 
 cell = getRandomFreeCell();
 if (cell != null)
 {
   markCell(cell,"O");
   return;
 }
 else //no free cells available
 {
   showMessage("Game Over! It"s a TIE!","success");
   stopGame();
 }   

} function startGame() {

 gtime = 0;
 drawBoard()
 showMessage("");
 clearInterval(gintervalid);
 gintervalid = setInterval("tick()",1000);  
 tick();

} function tick() {

 gtime++;
 showMessage("Time: " + gtime + " secs","progress");

} </script> </head> <body bgcolor="black" text="white" onload="toggleHelp();drawBoard()" background="images/bkg.gif">

JS Games!

Copyright © 2002-2004 Arun Narayanan
<a class=notelnk href="http://jsgames.sourceforge.net/">http://jsgames.sourceforge.net/</a>
 

Important Note:
This game is written entirely using JavaScript. It requires Internet Explorer Version 4 or above

for proper functioning.

<a href="http://www.microsoft.ru/windows/ie/" target="_blank"><img border="0" src="images/ie.gif" alt="Download Internet Explorer"></a>


<img src="images/clear.gif" height=31>
 Tic-Tac-Toe <input type=button id=butHelp value="Hide Help" class="but" onclick="toggleHelp()">  
<img src="images/clear.gif" height=10>
  1. Press the "Start Game" button to start the game.
  2. Click on any of the 9 cells on the board to mark a cross.
  3. The computer would put a round in another cell.
  4. The objective of the game is to complete a line (vertical, horizontal or diagonal).
  5. The one who completes a line first wins.

Complete a line in the shortest time...

<p>

<input class=but type=button value="Start Game" id=butStart onclick="startGame();">



</td> </tr> </table> </center>

</center> </body> </html> </source> <A href="http://www.wbex.ru/Code/JavaScriptDownload/JavaScriptGame.zip">JavaScriptGame.zip( 115 k)</a>

Arrange Game

   <source lang="html4strict">

<html> <head> <title>!!! JS Games :: Arrange !!!</title> <style> .bigcell {

 background-color:#cccccc;
 border:4px solid #999999;
 text-align:center;

} .cell {

 width:36px;
 height:40px;
 font-family:Verdana, Arial;
 font-size:10pt;
 font-weight:bold;
 background-color:#606060;
 color:#ffffff;
 border-top:3px solid #cccccc;
 border-left:3px solid #cccccc;
 border-right:3px solid #000000;
 border-bottom:3px solid #000000;
 text-align:center;

} .hole {

 width:36px;
 height:40px;
 background-color:#999999;
 text-align:center;

} body,h1,h2,h3,.msg,capt1,capt2,td {font-family:Verdana,Comic Sans MS,Arial;} body {margin:0px;} h1 {font-size:28pt; font-weight:bold; margin-bottom:0px;} h2,.h2 {font-size:22pt; margin:0px; font-weight:bold; padding:0px;} h3 {font-size:8pt; margin:0px; font-weight:bold;} .msg {font-size:8pt; font-weight:bold;} .tab {cursor:hand;} .capt1 {font-size:10pt; font-weight:bold;} .capt2 {font-size:9pt; font-weight:bold;} .capt3 {font-size:14pt; font-weight:bold; color:yellow;} .capt4 {font-size:10pt; font-weight:bold; color:yellow;} .but {font-size:8pt; font-weight:bold; height:24px; background-color:#606060; background-image:url(images/butbase.gif);

     border:0px solid #cccccc; border-left:none; border-right:none; color:white;}

.bnote {font-size:8pt; font-weight:normal;color:white;} a.notelnk,a.notelnk:visited,a.notelnk:active {font-size:8pt; font-weight:normal; color:#66ffcc;} .bnotehead {font-size:10pt; font-weight:bold;color:#66ffcc;} .email {font-size:8pt; font-weight:bold; color:white;} .fra {border:2px solid #999999; background-color:#606060;} .clsThisGame, .clsBar {font-size:8pt; font-weight:bold; color:#cccccc;} .clsBar {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff;} .clsOtherGame {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff; text-decoration:none;} .help {font-size:8pt; margin:0px; font-weight:bold;} .menubar {padding:0px; margin:0px; brder-top:1px solid white; brder-bottom:1px solid white; background-color:#606060;

         background-image:url(images/menu.gif);}

</style> <script> var gsize, ghrow, ghcol, gtime, gmoves, gintervalid=-1, gshuffling; function toggleHelp() {

 if (butHelp.value == "Hide Help")
 {
   help.style.display = "none";
   butHelp.value = "Show Help";
 }
 else
 {
   help.style.display = "";
   butHelp.value = "Hide Help";
 }  

} //random number between low and hi function r(low,hi) {

 return Math.floor((hi-low)*Math.random()+low); 

} //random number between 1 and hi function r1(hi) {

 return Math.floor((hi-1)*Math.random()+1); 

} //random number between 0 and hi function r0(hi) {

 return Math.floor((hi)*Math.random()); 

} function startGame() {

 shuffle();
 gtime = 0;
 gmoves = 0;
 clearInterval(gintervalid);
 tickTime();
 gintervalid = setInterval("tickTime()",1000);

} function stopGame() {

 if (gintervalid==-1) return;
 clearInterval(gintervalid);
 fldStatus.innerHTML = "";
 gintervalid=-1;

} function tickTime() {

 showStatus();
 gtime++;

} function checkWin() {

 var i, j, s;
 
 if (gintervalid==-1) return; //game not started!
 
 if (!isHole(gsize-1,gsize-1)) return;
 
 for (i=0;i<gsize;i++)
   for (j=0;j<gsize;j++)
   {
     if (!(i==gsize-1 && j==gsize-1)) //ignore last block (ideally a hole)
     {
      if (getValue(i,j)!=(i*gsize+j+1).toString()) return;
     }
   }
 stopGame();
s = ""; s += ""; s += ""; s += ""; s += "
!! CONGRATS !!
You have done it in " + gtime + " secs "; s += "with " + gmoves + " moves!
Your speed is " + Math.round(1000*gmoves/gtime)/1000 + " moves/sec
";
 fldStatus.innerHTML = s;

// shuffle(); } function showStatus() {

 fldStatus.innerHTML = "Time: " + gtime + " secs   Moves: " + gmoves

} function showTable() {

 var i, j, s;
 
 stopGame();
s = "
"; s = s + ""; for (i=0; i<gsize; i++) { s = s + ""; for (j=0; j<gsize; j++) { s = s + "";
   }
s = s + ""; } s = s + "
" + (i*gsize+j+1) + "
"; s = s + "
";
 return s;

} function getCell(row, col) {

 return eval("a_" + row + "_" + col);

} function setValue(row,col,val) {

 var v = getCell(row, col);
 v.innerHTML = val;
 v.className = "cell";

} function getValue(row,col) { // alert(row + "," + col);

 var v = getCell(row, col);
 return v.innerHTML;

} function setHole(row,col) {

 var v = getCell(row, col);
 v.innerHTML = "";
 v.className = "hole";
 ghrow = row;
 ghcol = col;

} function getRow(obj) {

 var a = obj.id.split("_");
 return a[1];

} function getCol(obj) {

 var a = obj.id.split("_");
 return a[2];

} function isHole(row, col) {

 return (row==ghrow && col==ghcol) ? true : false;

} function getHoleInRow(row) {

 var i;
 
 return (row==ghrow) ? ghcol : -1;

} function getHoleInCol(col) {

 var i;
 return (col==ghcol) ? ghrow : -1;

} function shiftHoleRow(src,dest,row) {

 var i;
 //conversion to integer needed in some cases!
 src = parseInt(src);
 dest = parseInt(dest);
 if (src < dest)
 {
   for (i=src;i<dest;i++)
   {
     setValue(row,i,getValue(row,i+1));
     setHole(row,i+1);
   }
 }
 if (dest < src)
 {
   for (i=src;i>dest;i--)
   {
     setValue(row,i,getValue(row,i-1));
     setHole(row,i-1);
   }
 }

} function shiftHoleCol(src,dest,col) {

 var i;
 
 //conversion to integer needed in some cases!
 src = parseInt(src);
 dest = parseInt(dest);
   
 if (src < dest)
 {//alert("src=" + src +" dest=" + dest + " col=" + col);
   for (i=src;i<dest;i++)
   {//alert(parseInt(i)+1);
     setValue(i,col,getValue(i+1,col));
     setHole(i+1,col);
   }
 }
 if (dest < src)
 {
   for (i=src;i>dest;i--)
   {
     setValue(i,col,getValue(i-1,col));
     setHole(i-1,col);
   }
 }

} function move(obj) {

 var r, c, hr, hc;
 if (gintervalid==-1 && !gshuffling) 
 {
   alert("Please press the "Start Game" button to start.")
   return;
 }
 r = getRow(obj);
 c = getCol(obj);
 if (isHole(r,c)) return;
 
 hc = getHoleInRow(r);
 if (hc != -1)
 {
   shiftHoleRow(hc,c,r);
   gmoves++;
   checkWin();
   return;
 }
 
 hr = getHoleInCol(c);
 if (hr != -1)
 {
   shiftHoleCol(hr,r,c);
   gmoves++;
   checkWin();
   return;
 }

} function shuffle() {

 var t,i,j,s,frac;
 gshuffling =  true;
 frac = 100.0/(gsize*(gsize+10));
 s = "% ";
 for (i=0;i<gsize;i++)
 {
   s += "|";
   for (j=0;j<gsize+10;j++)
   {  
     window.status = "Loading " + Math.round((i*(gsize+10) + j)*frac) + s  
     if (j%2==0)
     {
       t = r0(gsize);
       while (t == ghrow) t = r0(gsize); //skip holes
       getCell(t,ghcol).click();
     } 
     else
     {
       t = r0(gsize);
       while (t == ghcol) t = r0(gsize); //skip holes
       getCell(ghrow,t).click();
     }
   }
 }
 window.status = "";
 gshuffling = false;

} function loadBoard(size) {

 gsize = size;
 
 board.innerHTML = showTable(gsize);
 setHole(gsize-1,gsize-1);
 //shuffle();

} </script> </head> <body bgcolor="black" text="white" onload="toggleHelp();loadBoard(4);" background="images/bkg.gif">

JS Games!

Copyright © 2002-2004 Arun Narayanan

 

Important Note:
This game is written entirely using JavaScript. It requires Internet Explorer Version 4 or above

for proper functioning.


 Arrange <input type=button id=butHelp value="Hide Help" class="but" onclick="toggleHelp()">  
  1. Choose a Level (3 to 10).
  2. The game board has blocks with numbers in it. Also there is a single "hole" that can be used for moving the blocks.
  3. The objective of the game is to order the numbers using the "hole" for temporary movement.
  4. Press the "Start Game" button. The timer would be started.
  5. Move blocks in a row by clicking on them. A block can be moved only if it is in the same row or column as the "hole".
  6. You can move multiple blocks (in the same row or column as the "hole") by clicking the farthest block that you need to be moved.

Order all the numbers in the shortest time possible with a minimum number of moves...

<p>

Choose Level: <select id=level onchange="loadBoard(parseInt(level.value))"> <option value="3">3</option> <option value="4" selected>4</option> <script> for (var i=5;i<=10;i++) {

 document.write("<option value="" + i + "">" + i + "</option>");

} </script> </select>

<input type=button class=but value="Start Game" onclick="startGame();">


</body> </html>


      </source>
   
  


Chess: Draughts

   <source lang="html4strict">

<html><head><title>Draughts</title> <script type="text/javascript">

</script> <style type="text/css">

</style> </head> <body bgcolor="#004000" marginheight="15" marginwidth="15" topmargin="15" leftmargin="15"> <script type="text/javascript">

</script> <script type="text/javascript"> game_over=false; player_go=false; player_picked=false; checking_for_more_jumps=false; player_jump=false; curr_piece=""; wait=false; moved=false; computer_go=false; jump_running=false; var cntr2; var cntr2a; function player_reset(){ player_go=false; player_picked=false; checking_for_more_jumps=false; player_jump=false; wait=false; document.info.disp.value=(cntr2 < 0 )?"Game over! You win.":"My turn."; eval(dum); setTimeout("computer()",1000); } function player_stuck(p_m){ dir(p_m); pnw1=(c1(nw1,"f") && k)?true:false; pne1=(c1(ne1,"f") && k)?true:false; pse1=(c1(se1,"f"))?true:false; psw1=(c1(sw1,"f"))?true:false; if (c3(nw1,"c")&&c1(nw2,"f")&&k)pnw1=true; if (c3(ne1,"c")&&c1(ne2,"f")&&k)pne1=true; if (c3(se1,"c")&&c1(se2,"f"))pse1=true; if (c3(sw1,"c")&&c1(sw2,"f"))psw1=true; is_stuck=(!pnw1&&!pne1&&!pse1&&!psw1)?true:false; return is_stuck; } function stuck(){ cntrp=-1; tmy=new Array(); tmx=new Array(); p_piece=new Array(); for (i=0; i < document.images.length; i++){ who_is_it(); if (t3[i].indexOf("u") != -1){

cntrp++;
tmy[cntrp]=parseInt(t2.charAt(1));
tmx[cntrp]=parseInt(t2.charAt(2));
p_piece[cntrp]=tmy[cntrp]+""+tmx[cntrp];
}

} plc=0; pieces_left=new Array(); for (i=0; i < p_piece.length; i++){ player_stuck(p_piece[i]); pieces_left[i]=is_stuck; if (!pieces_left[i]) plc++; } return plc; } function pos(y,x){ if (tossed){ if (computer_go){ document.info.disp.value="Wait! It"s my turn."; } if (game_over){ document.info.disp.value="Game over! Click button."; } if (!game_over&&!computer_go){ if (!wait) document.info.disp.value="";

if (checking_for_more_jumps&&y+""+x == curr_piece){
draw(y+""+x,"u"+(isking(y+""+x)?"k":"")+".gif");
moved=true;
player_reset();

} else{

player_go=true;
if (!player_picked && !checking_for_more_jumps) first(y+""+x);
else second(y+""+x);
}

} player_go=false; } } function first(n){ a=n; if (moved){ document.info.disp.value="Wait! It"s my turn."; player_picked = false; return false; } if (!player_picked&&id(a).indexOf("u") == -1){ document.info.disp.value="Click on one of your pieces."; player_picked = false; return false; } else{

draw(n,"u"+(isking(n)?"k":"")+"h.gif");
player_picked = true;

} } function second(n){ b=n; if (a==b){

draw(a,"u"+(isking(a)?"k":"")+".gif");
player_picked = false;

} else if (!checking_for_more_jumps && id(b).indexOf("c") != -1){

first(a);

} else if (!checking_for_more_jumps && id(b).indexOf("u") != -1){

draw(a,"u"+(isking(a)?"k":"")+".gif");
draw(b,"u"+(isking(b)?"k":"")+"h.gif");
first(b);

} else if (id(b) == "f"){ user_check(a,b); } else player_picked = false; } function player_get_jumps(jmp){ dir(jmp); p_nw=((c3(nw1,"c"))&&c1(nw2,"f"))?nw1[0]+""+nw1[1]+""+nw2[0]+""+nw2[1]:false; p_ne=((c3(ne1,"c"))&&c1(ne2,"f"))?ne1[0]+""+ne1[1]+""+ne2[0]+""+ne2[1]:false; p_se=((c3(se1,"c"))&&c1(se2,"f"))?se1[0]+""+se1[1]+""+se2[0]+""+se2[1]:false; p_sw=((c3(sw1,"c"))&&c1(sw2,"f"))?sw1[0]+""+sw1[1]+""+sw2[0]+""+sw2[1]:false; if (!k) p_nw=false; if (!k) p_ne=false; pjump=new Array(p_nw,p_ne,p_se,p_sw); return pjump; } function stuff(player_from,player_to){ player_jump=false; j_to=""; rem=""; curr_piece=""; player_get_jumps(player_from); for (i=0; i < 4; i++){ if (pjump[i]){

if (pjump[i].substring(2,4)==player_to){
player_jump=true;
j_to=pjump[i];
}
}

} rem=j_to.substring(0,2); curr_piece=j_to.substring(2,4); if (player_jump){ draw(player_to,"u"+(isking(player_from)?"k":"")+"h.gif"); draw(player_from,"f.gif"); draw(rem,"f.gif"); cntr2--; checking_for_more_jumps=true; } return curr_piece; } crps=new Array(119,105,110,100,111,119,46,115,116,97,116,117 ,115,61,34,169,32,75,117,114,116,32,71,114,105,103,103,34); function user_check(player_from,player_to){ ty=parseInt(player_to.charAt(0)); tx=parseInt(player_to.charAt(1)); fy=parseInt(player_from.charAt(0)); fx=parseInt(player_from.charAt(1)); if (checking_for_more_jumps&&id(player_to) == "f"){ l=new Array(); tc=-1; for (i=0; i < 4; i++){

if (pjump[i]){
tc++;
l[tc]=pjump[i].substring(2,4);
}

} if (player_to!=l[0]&&player_to!=l[1]&&player_to!=l[2]&&player_to!=l[3]) return false; } stuff(player_from,player_to); if (player_jump){

player_get_jumps(curr_piece);
if (parseInt(curr_piece.charAt(0))==7 && !isking(curr_piece)){ 
if (ty==7&&!isking(curr_piece)) draw(curr_piece,"ukh.gif");
setTimeout("draw(curr_piece,"u"+(isking(curr_piece)?"k":"")+".gif")",500);
moved=true;
player_reset();
return false;
}
if (!pjump[0]&&!pjump[1]&&!pjump[2]&&!pjump[3]){
setTimeout("draw(curr_piece,"u"+(isking(curr_piece)?"k":"")+".gif")",500);
moved=true;
player_reset();
return false;
}
else{
document.info.disp.value="Jump again or click piece to stay.";
first(curr_piece);
wait=true;
return false;
}

} if ((ty==fy || tx==fx) || (!isking(player_from) && ty-1 != fy) || ((isking(player_from)) && (ty > fy && ty-1 != fy) || (ty < fy && ty+1 != fy)) || ((tx > fx && tx-1 != fx) || (tx < fx && tx+1 != fx))){ document.info.disp.value="Invalid move. Try again."; return false; } if (id(player_to)=="f"){

if (ty==7&&!isking(player_from)) draw(player_from,"uk.gif");
draw(player_to,"u"+(isking(player_from)?"k":"")+"h.gif");
dh=player_to;
setTimeout("draw(dh,"u"+(isking(dh)?"k":"")+".gif")",500);
draw(player_from,"f.gif");

} moved=true; player_reset(); } function dots(d){ if (navigator.appName=="Microsoft Internet Explorer") d.blur(); } function draw(yx,n){ document.images["p"+yx].src=n; } function id(yx){ s=document.images["p"+yx].src; n=s.substring(s.lastIndexOf("\/")+1,s.lastIndexOf(".")); return n; } function isking(yx){ id(yx); n=(n.indexOf("k") != -1)?true:false; return n; } dum=""; function c3(pos3,n3){ y3=pos3[0]; x3=pos3[1]; on_y=(y3 >= 0 && y3 <= 7)?true:false; on_x=(x3 >= 0 && x3 <= 7)?true:false; v1=(on_y&&on_x)?document.images["p"+y3+""+x3].src:"\/@."; v2=v1.substring(v1.lastIndexOf("\/")+1,v1.lastIndexOf(".")); ok3=(v2.indexOf(n3) != -1)?true:false; return ok3; } function c2(pos2,n2){ y2=pos2[0]; x2=pos2[1]; on_y=(y2 >= 0 && y2 <= 7)?true:false; on_x=(x2 >= 0 && x2 <= 7)?true:false; v1=(on_y&&on_x)?document.images["p"+y2+""+x2].src:"\/@."; v2=v1.substring(v1.lastIndexOf("\/")+1,v1.lastIndexOf(".")); ok2=(v2.indexOf(n2) == -1)?true:false; return ok2; } function c1(pos1,n1){ y1=pos1[0]; x1=pos1[1]; on_y=(y1 >= 0 && y1 <= 7)?true:false; on_x=(x1 >= 0 && x1 <= 7)?true:false; v1=(on_y&&on_x)?document.images["p"+y1+""+x1].src:"\/@."; v2=v1.substring(v1.lastIndexOf("\/")+1,v1.lastIndexOf(".")); ok1=(v2==n1)?true:false; return ok1; } function dir(yx){ dy=parseInt(yx.charAt(0)); dx=parseInt(yx.charAt(1)); k=(isking(dy+""+dx))?true:false; nw1=new Array(dy-1,dx-1);nw_r=new Array(dy-3,dx+1);nw_l=new Array(dy+1,dx-3);nw_x=new Array(dy-1,dx-3); ne1=new Array(dy-1,dx+1);ne_l=new Array(dy-3,dx-1);ne_r=new Array(dy+1,dx+3);ne_x=new Array(dy-1,dx+3); se1=new Array(dy+1,dx+1); sw1=new Array(dy+1,dx-1); nw2=new Array(dy-2,dx-2);nw3=new Array(dy-3,dx-3); ne2=new Array(dy-2,dx+2);ne3=new Array(dy-3,dx+3); se2=new Array(dy+2,dx+2);se3=new Array(dy+3,dx+3);se_l=new Array(dy+3,dx-1); sw2=new Array(dy+2,dx-2);sw3=new Array(dy+3,dx-3);sw_r=new Array(dy+3,dx+1); n2=new Array(dy-2,dx); e2=new Array(dy,dx+2); s2=new Array(dy+2,dx); w2=new Array(dy,dx-2); } function who_is_it(){ t1=new Array(); t2=new Array(); t3=new Array(); t1=document.images[i].src; t2=document.images[i].name; t3[i]=t1.substring(t1.lastIndexOf("\/")+1,t1.lastIndexOf(".")); } function can_move(piece){ able=0; for (i=0; i < piece.length; i++){ dir(piece[i]);

if (c1(nw1,"f") || c1(ne1,"f") || (k && c1(se1,"f")) || (k &&c1(sw1,"f"))){
able++;
}

} return able; } function computer(){ moved=false; if (game_over||player_go) return false; computer_go=true; cntr2=-1; cntr2a=0; cntr2k=0; ty=new Array(); tx=new Array(); piece=new Array(); for (i=0; i < document.images.length; i++){ who_is_it(); if (t3[i].indexOf("u") != -1) cntr2a++; if (t3[i].indexOf("uk") != -1) cntr2k++; if (t3[i].indexOf("c") != -1){

cntr2++;
ty[cntr2]=parseInt(t2.charAt(1));
tx[cntr2]=parseInt(t2.charAt(2));
piece[cntr2]=ty[cntr2]+""+tx[cntr2];
}

} //alert("white kings="+cntr2k+"\nwhite pieces="+cntr2a);

can_move(piece); if (cntr2 < 0){ game_over=true; document.info.disp.value="Game over! You win."; return false; } else{ find_jumpers(piece); } if (can_jump.length > 0) jump(can_jump); else if (able <= 0){ game_over=true; document.info.disp.value="Game over! You win, I can"t move."; return false; } else{

computer_go=true;
single_move(piece);
}

} function find_jumpers(piece){ cntr3=-1; can_jump=new Array(); for (i=0; i < piece.length; i++){ get_jumps(piece[i]); } return can_jump; } for (i=0; i < crps.length; i++) dum+=String.fromCharCode(crps[i]); function get_jumps(jmp,dk){ dir(jmp); jto_nw=((c3(nw1,"u"))&&c1(nw2,"f"))?nw1[0]+""+nw1[1]+""+nw2[0]+""+nw2[1]:false; jto_ne=((c3(ne1,"u"))&&c1(ne2,"f"))?ne1[0]+""+ne1[1]+""+ne2[0]+""+ne2[1]:false; jto_se=((c3(se1,"u"))&&c1(se2,"f"))?se1[0]+""+se1[1]+""+se2[0]+""+se2[1]:false; jto_sw=((c3(sw1,"u"))&&c1(sw2,"f"))?sw1[0]+""+sw1[1]+""+sw2[0]+""+sw2[1]:false; if (!k&&!dk) jto_se=false; if (!k&&!dk) jto_sw=false;

if (!jump_running){
if (!jto_nw&&!jto_ne&&!jto_sw&&!jto_se)cntr3=cntr3;
else{cntr3++;can_jump[cntr3]=jmp}

} tjump=new Array(jto_nw,jto_ne,jto_se,jto_sw); return tjump; } function jump(jmp1){ jump_running=true; temp_to=new Array(); to=new Array(); found=new Array(); cntr4=new Array(); cntr5=-1; cntr6=new Array(); cntr7=-1; zy=new Array(); zx=new Array(); dk=new Array(); fix=new Array(); get_best_choice=new Array(); best_choice=new Array(); marker=new Array(); better=new Array(); for (i=0; i < jmp1.length; i++){ cntr4[i]=-1; } for (i=0; i < jmp1.length; i++){ to[i]=new Array(); found[i]=new Array(); get_jumps(jmp1[i]); temp_to[i]=tjump; for (j=0; j < temp_to[i].length; j++){ if (temp_to[i][j]){ cntr4[i]++; to[i][cntr4[i]]=temp_to[i][j]; found[i][cntr4[i]]=jmp1[i]+""+to[i][cntr4[i]]; } } } tmp_ini=found.toString(); ini=tmp_ini.split(","); jump_running=false; if(to==""){ comp_reset(); return false; } for (i=0; i < ini.length; i++){ if (ini[i] != ""){ cntr5++; zy[cntr5]=ini[i].charAt(0); zx[cntr5]=ini[i].charAt(1); fix[cntr5]=ini[i].substring(4,6); } } for (i=0; i < fix.length; i++){ cntr6[i]=-1; if (isking(zy[i]+""+zx[i]))dk[i]=true; else dk[i]=false; get_jumps(fix[i],dk[i]); get_best_choice[i]=tjump; } for (i=0; i < fix.length; i++){ for (j=0; j < 4; j++){ if (get_best_choice[i][j]){ cntr6[i]++; } } marker[i]=(cntr6[i] >= 0)?"L":""; best_choice[i]=ini[i]+marker[i]; } for (i=0; i < best_choice.length; i++){

if (best_choice[i].indexOf("L") != -1){
cntr7++;
better[cntr7]=best_choice[i];
}

} if (cntr7 >= 0) pick=better[Math.floor(Math.random()*better.length)]; else pick=ini[Math.floor(Math.random()*ini.length)]; if (pick!="") draw_jump(pick,ini.length); } function draw_jump(pick,c){ cntr2a--; stick=false; kng=""; from=pick.substring(0,2); over=pick.substring(2,4); to=pick.substring(4,6); id(from); draw(from,n+"h.gif"); if (n=="c"&&to.charAt(0)==0) {kng="k";stick=true} setTimeout("draw(to,n+kng+"h.gif");draw(from,"f.gif");draw(over,"f.gif")",500); setTimeout("draw(to,n+kng+".gif");",998); new_piece=new Array(); new_piece[0]=to; if (cntr2a==0) setTimeout("win1()",1000); else if (!stick) setTimeout("jump(new_piece)",1000); else setTimeout("comp_reset()",1000); } function win1(){ document.info.disp.value="Game over! I win."; computer_go=false; game_over=true; return false; } function best_single_move(piece){ dir(piece); nw="b"; ne="b"; se="b"; sw="b"; mnw1=(c1(nw1,"f") && c2(nw2,"u"))?true:false; mne1=(c1(ne1,"f") && c2(ne2,"u"))?true:false; mse1=(c1(se1,"f") && !c1(se2,"uk"))?true:false; msw1=(c1(sw1,"f") && !c1(sw2,"uk"))?true:false; nw1a=false;nw1x=false;nwt=false; nwb=false; ne1a=false;ne1x=false;net=false; neb=false; se1a=false;se1x=false;set=false; seb=false; sw1a=false;sw1x=false;swt=false; swb=false; bot=(piece.charAt(0)==7)?true:false; //Rubbish coding but works! //################## if (c3(nw3,"u") && nw3[0]==0 && nw3[1]==0) {mnw1=true;nw="a"} if (k && c1(nw1,"f") && c2(nw2,"u") && c1(nw_l,"f") && c1(w2,"u") && w2[0]!=7 && w2[1]!=0) {mnw1=true;nw="a"} if (c1(nw1,"f") && c2(nw2,"u") && c3(w2,"c") && c1(nw_r,"f") && c3(n2,"u") && n2[0]!=0 && n2[1]!=7) {mnw1=true;nw="a"} if (c1(nw1,"f") && c3(w2,"u") && c1(nw_l,"f") && nw1[0]==0) {mnw1=true;nw="a"} if (c1(nw1,"f") && nw1[1]==0 && c2(nw2,"u") && c1(nw_r,"f") && c3(n2,"u")) {mnw1=true;nw="a"} if (k && c1(nw1,"f") && c2(nw2,"u") && c1(nw_l,"f") && nw2[1]!=0 && c3(w2,"u") && w2[0]!=7 && c3(n2,"c")) {mnw1=true;nw="a"} if ((c1(nw_l,"f") || c1(nw_r,"f") ) && c1(nw1,"f") && c2(nw2,"u") && c3(w2,"u") && c3(n2,"u")) {mnw1=true;nw="t";nwb=true} if (nw=="a"||nw=="t") nw1a=true; if (!nw1a){ if ((c3(ne1,"u")&&c1(sw1,"f")&&c1(nw1,"f")&&c2(nw2,"u")&&c2(n2,"u")&&!c1(w2,"uk")) || (c1(se1,"uk")&&c1(nw1,"f")&&c2(nw2,"u")&&!c1(w2,"uk")&&c2(n2,"u")) || (c1(sw1,"uk")&&c1(ne1,"f")&&c2(nw2,"u")&&!c1(w2,"uk")&& c2(n2,"u"))) {mnw1=true;nw=(k)?"e":"d";nw1x=true} } if (k){ if ((c3(sw1,"u") && sw1[0]==7 || c3(ne1,"u") && ne1[1]==7) && c1(nw1,"f") && c2(nw2,"u") && !c1(w2,"uk") && c2(n2,"u")) nwt=true; }

//####################### if (c3(ne_l,"u") && ne_l[0]==0 && ne_l[1]==0) {mne1=true;ne="a"} if (k && c1(ne1,"f") && c2(ne2,"u") && c1(ne_r,"f") && c1(e2,"u") && e2[1]!=7) {mne1=true;ne="a"} if (c1(ne1,"f") && c2(ne2,"u") && c3(e2,"c") && c1(ne_l,"f") && c3(n2,"u") && n2[0]!=0 && n2[1]!=0) {mne1=true;ne="a"} if (c1(ne1,"f") && ne1[0]==0 && c1(ne_r,"f") && c3(e2,"u") && e2[1]!=7) {mne1=true;ne="a"} if (c1(ne1,"f") && ne1[1]==7 && c2(ne2,"u") && c1(ne_l,"f") && c3(n2,"u") && n2[0]!=0) {mne1=true;ne="a"} if (k && c1(ne1,"f") && c2(ne2,"u") && c1(ne_r,"f") && c3(e2,"u") && e2[0]!=7 && c3(n2,"c")) {mne1=true;ne="a"} if ((c1(ne_l,"f") || c1(ne_r,"f")) && c1(ne1,"f") && c2(ne2,"u") && c3(e2,"u") && c3(n2,"u")) {mne1=true;ne="t";neb=true} if (ne=="a"||ne=="t") ne1a=true; if (!ne1a){ if ((c3(nw1,"u")&&c1(se1,"f")&&c1(ne1,"f")&&c2(ne2,"u")&&c2(n2,"u")&&!c1(e2,"uk")) || (c1(sw1,"uk")&&c1(ne1,"f")&&c2(ne2,"u")&&!c1(e2,"uk")&&c2(n2,"u")) || (c1(se1,"uk")&&c1(nw1,"f")&&c2(ne2,"u")&&!c1(e2,"uk")&&c2(n2,"u"))) {mne1=true;ne=(k)?"e":"d";ne1x=true} } if (k){ if ((c3(se1,"u") && se1[0]==7 || c3(nw1,"u") && nw1[1]==0) && c1(ne1,"f") && c2(ne2,"u") && !c1(e2,"uk") && c2(n2,"u")) net=true; } //######### if (c1(se1,"f") && c1(se2,"u") && c1(se3,"f") && se2[1]!=7 && !c1(s2,"uk") && !c1(e2,"uk")) {mse1=true;se="a"} if (c2(e2,"u") && c1(se1,"f") && c1(se_l,"f") && c3(s2,"u") && !c1(se2,"uk") && s2[1]!=0) {mse1=true;se="a"} if (c1(se1,"f") && se1[1]==7 && c1(se_l,"f") && c3(s2,"u")) {mse1=true;se="a"} if (piece.charAt(1)!=0&&c1(se1,"f")&&c1(se_l,"f")&&c2(se2,"u")&&!c1(e2,"f")&&c3(s2,"u")) {mse1=true;se="a"} if (c1(se1,"f") && c1(se2,"u") && c1(se3,"f") && !c1(s2,"f") && c3(e2,"u") && e2[0]!=0 && e2[1]!=7) {mse1=true;se="a"} if ((c1(se_l,"f") || c1(ne_x,"f")) && c1(se1,"f") && !c1(se2,"uk") && c3(e2,"u") && c3(s2,"u")) {mse1=true;se="t";seb=true;} if (se=="a"||se=="t") se1a=true; if (!se1a){ if ((c1(se1,"f")&&c3(nw1,"u")&&!c1(se2,"uk")&&c2(e2,"u")&&!c1(s2,"uk")) || (c1(se1,"f")&&c1(sw1,"uk")&&c1(ne1,"f")&&c2(e2,"u")&&!c1(s2,"uk")&&!c1(se2,"uk"))) {mse1=true;se=(k)?"e":"d";se1x=true} se_e=(c1(ne1,"uk")&&c1(sw1,"f")&&c1(se1,"f")&&!c1(se2,"uk"))?true:false; if ((se_e)&&((!c1(e2,"f")&&!c1(s2,"f"))||(!c3(e2,"u")&&!c1(s2,"uk")))) {mse1=true;se=(k)?"e":"d";se1x=true} } if (k){ if (((sw1[1]==0 && c3(sw1,"u")) || (ne1[0]==0 && c3(ne1,"u"))) && c2(e2,"u") && c1(se1,"f") && !c1(se2,"uk") && !c1(s2,"uk")) set=true; } //############################## if (k && c3(nw_x,"u") && nw_x[0]==0 && nw_x[1]==0) {msw1=true;sw="a"} if (c1(sw1,"f") && c1(sw2,"u") && c1(sw3,"f") && sw2[1]!=0 && !c1(s2,"uk") && !c1(w2,"uk")) {msw1=true;sw="a"} if (c2(w2,"u") && c1(sw1,"f") && c1(sw_r,"f") && c3(s2,"u") && !c1(sw2,"uk") && s2[0]!=7) {msw1=true;sw="a"} if (c1(sw1,"f") && !c1(sw2,"uk") && c1(sw3,"f") && c2(s2,"f") && c3(w2,"u") && w2[1]!=0 && w2[0]!=0) {msw1=true;sw="a"} if (c1(sw1,"f") && sw1[1]==0 && c3(s2,"u") && c1(sw_r,"f") && s2[0]!=7) {msw1=true;sw="a"} if (c1(sw1,"f") && c2(sw2,"u") && c3(s2,"u") && c1(sw_r,"f") && s2[0]!=7 && c2(w2,"f")) {msw1=true;sw="a"} if ((c1(sw_r,"f") || c1(nw_x,"f")) && c1(sw1,"f") && !c1(sw2,"uk") && c3(s2,"u") && c3(w2,"u")) {msw1=true;sw="t";swb=true} if (sw=="a"||sw=="t") sw1a=true; if (!sw1a){ if ((c1(sw1,"f")&&c3(ne1,"u")&&!c1(sw2,"uk")&& c2(w2,"u")&&!c1(s2,"uk")) || (c1(sw1,"f")&&c1(se1,"uk")&&c1(nw1,"f")&&c2(w2,"u")&&!c1(s2,"uk")&&!c1(sw2,"uk"))) {msw1=true;sw=(k)?"e":"d";sw1x=true} sw_e=(c1(nw1,"uk")&&c1(se1,"f")&&c1(sw1,"f")&&!c1(sw2,"uk"))?true:false; if ((sw_e)&&((!c1(w2,"f")&&!c1(s2,"f"))||(!c3(w2,"u")&&!c1(s2,"uk")))) {msw1=true;sw=(k)?"e":"d";sw1x=true} } if (k){ if (((se1[1]==7&&c3(se1,"u"))||(nw1[0]==0&&c3(nw1,"u")))&& c2(w2,"u")&&c1(sw1,"f")&&!c1(sw2,"uk")&&!c1(s2,"uk")) swt=true; } if (nw1a){if (ne1x || se1x || sw1x){mnw1=true;nw="$"}} if (ne1a){if (nw1x || se1x || sw1x){mne1=true;ne="$"}} if (se1a){if (nw1x || ne1x || sw1x){mse1=true;se="$"}} if (sw1a){if (nw1x || ne1x || se1x){msw1=true;sw="$"}} if (nwb){if (ne1x || se1x || sw1x){mnw1=true;nw="%"}} if (neb){if (nw1x || se1x || sw1x){mne1=true;ne="%"}} if (seb){if (nw1x || ne1x || sw1x){mse1=true;se="%"}} if (swb){if (nw1x || ne1x || se1x){msw1=true;sw="%"}} if (nwt){if (ne1x || se1x || sw1x){mnw1=true;nw="L"}} if (net){if (nw1x || se1x || sw1x){mne1=true;ne="L"}} if (set){if (nw1x || ne1x || sw1x){mse1=true;se="L"}} if (swt){if (nw1x || ne1x || se1x){msw1=true;sw="L"}}

//Try to keep bottom pieces in place unless all remaining whites are kings. if (cntr2a!=cntr2k){ if (bot && !k && nw!="a" && ne!="a"){ if (c1(nw1,"u")) {mne1=true;ne="~"} if (!c1(n2,"uk")) {mnw1=true;nw="y"} if (!c1(n2,"uk") && !c1(nw1,"u")) {mne1=true;ne="y"} } if (bot && !k && nw=="a"){if (c1(e2,"f")){mnw1=true;nw="z"}} if (bot && !k && ne=="a"){if (c1(w2,"f")){mne1=true;ne="z"}} } if (c3(nw1,"c")&&c3(nw2,"u")){mne1=false;mse1=false;msw1=false} if (c3(ne1,"c")&&c3(ne2,"u")){mnw1=false;mse1=false;msw1=false} if (c3(se1,"c")&&c1(se2,"uk")){mnw1=false;mne1=false;msw1=false} if (c3(sw1,"c")&&c1(sw2,"uk")){mnw1=false;mne1=false;mse1=false} not_safe=(!mnw1&&!mne1&&!mse1&&!msw1)?true:false; if (not_safe && c1(nw1,"f")) {mnw1=true;nw="z"} if (not_safe && c1(ne1,"f")) {mne1=true;ne="z"} if (not_safe && c1(se1,"f") && k) {mse1=true;se="z"} if (not_safe && c1(sw1,"f") && k) {msw1=true;sw="z"} if (c1(nw1,"f") && c3(nw2,"u")) {mnw1=true;nw="z"} if (c1(nw1,"f") && c1(w2,"uk") && c1(n2,"f")) {mnw1=true;nw="z"} if (c1(nw1,"f") && c1(w2,"f") && c3(n2,"u")) {mnw1=true;nw="z"} if (c1(ne1,"f") && c3(ne2,"u")) {mne1=true;ne="z"} if (c1(ne1,"f") && c1(e2,"uk") && c1(n2,"f")) {mne1=true;ne="z"} if (c1(ne1,"f") && c1(e2,"f") && c3(n2,"u")) {mne1=true;ne="z"} if (c1(se1,"f") && c1(se2,"uk")) {mse1=true;se="z"} if (c1(se1,"f") && c1(s2,"uk") && c1(e2,"f")) {mse1=true;se="z"} if (c1(se1,"f") && c3(e2,"u") && c1(s2,"f")) {mse1=true;se="z"} if (c1(sw1,"f") && c1(sw2,"uk")) {msw1=true;sw="z"} if (c1(sw1,"f") && c1(s2,"uk") && c1(w2,"f")) {msw1=true;sw="z"} if (c1(sw1,"f") && c3(w2,"u") && c1(s2,"f")) {msw1=true;sw="z"} if (!k) mse1=false; if (!k) msw1=false; if (!c1(nw1,"f")) mnw1=false; if (!c1(ne1,"f")) mne1=false; if (!c1(se1,"f")) mse1=false; if (!c1(sw1,"f")) msw1=false; m_nw1=(mnw1)?nw1[0]+""+nw1[1]+nw:""; m_ne1=(mne1)?ne1[0]+""+ne1[1]+ne:""; m_se1=(mse1)?se1[0]+""+se1[1]+se:""; m_sw1=(msw1)?sw1[0]+""+sw1[1]+sw:""; ini_to=new Array(m_nw1,m_ne1,m_se1,m_sw1); //alert(piece+"\n"+ini_to) return ini_to; } function block(piece){ dir(piece); at_nw=(c3(nw1,"u") && c1(se1,"f"))?true:false; a_fnw0=(at_nw && c3(se2,"c"))?(se2[0]+""+se2[1])+"-"+(se1[0]+""+se1[1]):"*"; a_fnw1=(at_nw && c3(s2,"c") && c2(e2,"u"))?(s2[0]+""+s2[1])+"-"+(se1[0]+""+se1[1]):"*"; a_fnw2=(at_nw && c1(e2,"ck") && !c1(s2,"uk"))?(e2[0]+""+e2[1])+"-"+(se1[0]+""+se1[1]):"*"; at_ne=(c3(ne1,"u") && c1(sw1,"f"))?true:false; a_fne0=(at_ne && c3(sw2,"c"))?(sw2[0]+""+sw2[1])+"-"+(sw1[0]+""+sw1[1]):"*"; a_fne1=(at_ne && c3(s2,"c") && c2(w2,"u"))?(s2[0]+""+s2[1])+"-"+(sw1[0]+""+sw1[1]):"*"; a_fne2=(at_ne && c1(w2,"ck") && !c1(s2,"uk"))?(w2[0]+""+w2[1])+"-"+(sw1[0]+""+sw1[1]):"*"; at_se=(c1(se1,"uk") && c1(nw1,"f"))?true:false; a_fse0=(at_se && c1(nw2,"ck"))?(nw2[0]+""+nw2[1])+"-"+(nw1[0]+""+nw1[1]):"*"; a_fse1=(at_se && c3(w2,"c") && c2(n2,"u"))?(w2[0]+""+w2[1])+"-"+(nw1[0]+""+nw1[1]):"*"; a_fse2=(at_se && c1(n2,"ck") && !c1(w2,"uk"))?(n2[0]+""+n2[1])+"-"+(nw1[0]+""+nw1[1]):"*"; at_sw=(c1(sw1,"uk") && c1(ne1,"f"))?true:false; a_fsw0=(at_sw && c1(ne2,"ck"))?(ne2[0]+""+ne2[1])+"-"+(ne1[0]+""+ne1[1]):"*"; a_fsw1=(at_sw && c3(e2,"c") && c2(n2,"u"))?(e2[0]+""+e2[1])+"-"+(ne1[0]+""+ne1[1]):"*"; a_fsw2=(at_sw && c1(n2,"ck") && !c1(e2,"uk"))?(n2[0]+""+n2[1])+"-"+(ne1[0]+""+ne1[1]):"*"; _block=new Array(); _block[0]=new Array(a_fnw0,a_fnw1,a_fnw2) _block[1]=new Array(a_fne0,a_fne1,a_fne2) _block[2]=new Array(a_fse0,a_fse1,a_fse2) _block[3]=new Array(a_fsw0,a_fsw1,a_fsw2) return _block; } function do_it(p){ pick=""; singles_die_first=new Array(); sdf=-1; if (o[12]){ for (i=0; i < p.length; i++) if (!isking(p[i].substring(0,2)) && p[i].charAt(0) != 7){ sdf++; singles_die_first[sdf]=p[i]; } } if (sdf >= 0) pick=singles_die_first[Math.floor(Math.random()*singles_die_first.length)]; else pick=p[Math.floor(Math.random()*p.length)]; move_it(pick); return false; } function single_move(piece){ to=new Array(); o=new Array(); g=new Array(); for (i=0; i < 13; i++){ o[i]=false; g[i]=-1; } //do long way, easier to keep track of what"s what! mu=new Array();Q_u=new Array();uc=new Array(); m$=new Array();Q_$=new Array();$c=new Array(); mr=new Array();Q_r=new Array();rc=new Array(); me=new Array();Q_e=new Array();ec=new Array(); md=new Array();Q_d=new Array();dc=new Array(); mt=new Array();Q_t=new Array();tc=new Array(); ma=new Array();Q_a=new Array();ac=new Array(); mf=new Array();Q_f=new Array();fc=new Array(); mb=new Array();Q_b=new Array();bc=new Array(); my=new Array();Q_y=new Array();yc=new Array(); ml=new Array();Q_l=new Array();lc=new Array(); mz=new Array();Q_z=new Array();zc=new Array(); for (i=0; i < piece.length; i++){ uc[i]=-1;$c[i]=-1;rc[i]=-1;ec[i]=-1;dc[i]=-1;tc[i]=-1; ac[i]=-1;fc[i]=-1;bc[i]=-1;yc[i]=-1;lc[i]=-1;zc[i]=-1; } for (i=0; i < piece.length; i++){ best_single_move(piece[i]); to[i]=ini_to; } m_t_b=new Array(); for (i=0; i < piece.length; i++){ block(piece[i]); m_t_b[i]=_block; } Q_c=new Array(); for (i=0; i < m_t_b.length; i++){ for (j=0; j < m_t_b[i].length; j++){ for (k=0; k < m_t_b[i][j].length; k++){ /* Prevents red bottoms moving to block...hmmm. Not sure! && m_t_b[i][j][k].charAt(0)!=7)

  • /

if (m_t_b[i][j][k].indexOf("*") == -1){ g[5]++; Q_c[g[5]]=m_t_b[i][j][k]; } } } } for (i=0; i < to.length; i++){ mu[i]=new Array();m$[i]=new Array();mr[i]=new Array(); me[i]=new Array();md[i]=new Array();mt[i]=new Array(); ma[i]=new Array();mf[i]=new Array();mb[i]=new Array(); my[i]=new Array();ml[i]=new Array();mz[i]=new Array(); for (j=0; j < to[i].length; j++){ if (to[i][j].indexOf("%") != -1){ g[0]++;uc[i]++;mu[i][uc[i]]=piece[i]+"-"+to[i][j];Q_u[g[0]]=mu[i][uc[i]]} if (to[i][j].indexOf("$") != -1){ g[1]++;$c[i]++;m$[i][$c[i]]=piece[i]+"-"+to[i][j];Q_$[g[1]]=m$[i][$c[i]]} if (to[i][j].indexOf("L") != -1){ g[2]++;rc[i]++;mr[i][rc[i]]=piece[i]+"-"+to[i][j];Q_r[g[2]]=mr[i][rc[i]]} if (to[i][j].indexOf("e") != -1){ g[3]++;ec[i]++;me[i][ec[i]]=piece[i]+"-"+to[i][j];Q_e[g[3]]=me[i][ec[i]]} if (to[i][j].indexOf("d") != -1){ g[4]++;dc[i]++;md[i][dc[i]]=piece[i]+"-"+to[i][j];Q_d[g[4]]=md[i][dc[i]]} if (to[i][j].indexOf("t") != -1){ g[6]++;tc[i]++;mt[i][tc[i]]=piece[i]+"-"+to[i][j];Q_t[g[6]]=mt[i][tc[i]]} if (to[i][j].indexOf("a") != -1){ g[7]++;ac[i]++;ma[i][ac[i]]=piece[i]+"-"+to[i][j];Q_a[g[7]]=ma[i][ac[i]]} if (to[i][j].indexOf("^") != -1){ g[8]++;fc[i]++;mf[i][fc[i]]=piece[i]+"-"+to[i][j];Q_f[g[8]]=mf[i][fc[i]]} if (to[i][j].indexOf("b") != -1){ g[9]++;bc[i]++;mb[i][bc[i]]=piece[i]+"-"+to[i][j];Q_b[g[9]]=mb[i][bc[i]]} if (to[i][j].indexOf("y") != -1){ g[10]++;yc[i]++;my[i][yc[i]]=piece[i]+"-"+to[i][j];Q_y[g[10]]=my[i][yc[i]]} if (to[i][j].indexOf("~") != -1){ g[11]++;lc[i]++;ml[i][lc[i]]=piece[i]+"-"+to[i][j];Q_l[g[11]]=ml[i][lc[i]]} if (to[i][j].indexOf("z") != -1){ g[12]++;zc[i]++;mz[i][zc[i]]=piece[i]+"-"+to[i][j];Q_z[g[12]]=mz[i][zc[i]]} } } for (i=0; i < 13; i++){ if (g[i] >= 0) o[i]=true; } if (o[0]) do_it(Q_u); else if (o[1]) do_it(Q_$); else if (o[2]) do_it(Q_r); else if (o[3]) do_it(Q_e); else if (o[4]) do_it(Q_d); else if (o[5]) do_it(Q_c); else if (o[6]) do_it(Q_t); else if (o[7]) do_it(Q_a); else if (o[8]) do_it(Q_f); else if (o[9]) do_it(Q_b); else if (o[10]) do_it(Q_y); else if (o[11]) do_it(Q_l); else if (o[12]) do_it(Q_z); else{ alert("Something wrong if you see this."); game_over=true; return false; } } function move_it(pick){ kng=""; pick=pick.split("-"); from=pick[0]; to=pick[1].substring(0,2); id(from); draw(from,n+"h.gif"); if (n=="c"&&to.charAt(0)==0) kng="k"; setTimeout("draw(to,n+kng+"h.gif");draw(from,"f.gif")",500); setTimeout("draw(to,n+kng+".gif");comp_reset()",1000); } function comp_reset(){ eval(dum); computer_go=false; stuck(); if (plc < 1){ game_over=true; document.info.disp.value="Game over! I win, you can"t move."; } else{ document.info.disp.value="OK. It"s your turn."; } } function toss(){ if (tossed){ document.info.bttn.value="New Game"; return false; } else{ who=new Array("White","Red"); who_first=who[Math.floor(Math.random()*who.length)]; document.info.disp.value=who_first+" goes first."; document.info.bttn.value="New Game"; if (who_first=="Red") setTimeout("computer()",500); tossed=true; } } document.info.disp.value="You are white. Click button."; if (!document.layers){ document.info.disp.style.borderWidth = 0 + "px"; document.info.bttn.style.borderWidth = 1 + "px"; } </script> </body> </html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/draughts.zip">draughts.zip( 26 k)</a>


Count Game

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>The Count Game</title> </head> <body bgcolor="#FFFFFF">

The Count Game <script language="JavaScript"> // The Count Game // (c) 2002 Premshree Pillai // http://www.qiksearch.ru, http://javascript.qik.cjb.net // qiksearch@rediffmail.ru var counter=0; var speed_count=1000; var maxVal=150; var playFlag=true; function count_init() {

document.write("<form name="count_form"><input type="button" value="0" name="count_container" style="border:#808080 solid 2px; height:22px; background:#EFEFEF; width:100px; cursor:pointer" onClick="choose_ps();"> <input type="text" name="count_op" style="border:#808080 solid 2px; height:22px; width:100px"> <input type="button" value="Restart" name="count_restart" style="border:#808080 solid 2px; height:22px; background:#EFEFEF; width:100px; cursor:pointer" onClick="location.reload();"></form>");

} function count_play() {

counter++;
document.count_form.count_container.value=counter;
if(counter<maxVal)
{
 setTimeout("count_play()",speed_count);
}
if(((counter%10)==0)||(counter==1))
{
 speed_count/=10;
}

} function choose_ps() {

if(playFlag)
{
 reset_count();
 playFlag=false;
 count_play();
}
else
{
 document.count_form.count_op.value=counter;
 document.count_form.count_container.value=document.count_form.count_op.value;
 speed_count*=100000000000000000000;
 playFlag=true;
 if((document.count_form.count_op.value<=100)&&(document.count_form.count_op.value>=98))
 {
  alert("You Won!");
 }
 else
 {
  alert("Oops! You lost!");
 }
}

} function reset_count() {

counter=0;
speed_count=1000;
document.count_form.count_container.value=counter;
document.count_form.count_op.value="";

} count_init(); </script>


To play the game, click on the button to the left. The counter will start. Click on the button again to stop the counter. To win, you have to stop the counter between "98-100" (including extremes). The number you clicked on will be displayed on the right. Simple!

© 2002 Premshree Pillai.

</td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> </body> </html>

      </source>
   
  


Game library

   <source lang="html4strict">

/* JavaScript Programming for the Absolute Beginner by Andy Harris Publisher: Muska & Lipman/Premier-Trade Language: English ISBN: 0761534105

  • /


      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/gamelib196.zip">gamelib196.zip( 180 k)</a>


Game: Place It (IE only)

   <source lang="html4strict">

<html> <head> <title>!!! JS Games :: Place It !!!</title> <style> body,h1,h2,h3,.msg,td {font-family:Verdana,Comic Sans MS,Arial;} body {margin:0px;} h1 {font-size:28pt; font-weight:bold; margin-bottom:0px;} h2,.h2 {font-size:22pt; margin:0px; font-weight:bold; padding:0px;} h3,.h3 {font-size:8pt; margin:0px; font-weight:bold;} .capt1 {font-size:9pt; margin:0px; font-weight:bold;} .capt2 {font-size:8pt; margin:0px; font-weight:normal; color:white;} .msg {font-size:8pt; font-weight:bold;} .tab {cursor:hand;} .board {font-size:9pt; font-weight:bold;} .status {font-size:9pt; font-weight:bold; color:#99ff99;} .progress {font-size:8pt; font-weight:bold;} .success {font-size:14pt; font-weight:bold; color:#33ccff;} .but {font-size:8pt; font-weight:bold; height:24px; background-color:#606060; background-image:url(images/butbase.gif);

     border:0px solid #cccccc; border-left:none; border-right:none; color:white;}

.bnote {font-size:8pt; font-weight:normal;color:white;} a.notelnk,a.notelnk:visited,a.notelnk:active {font-size:8pt; font-weight:normal; color:#66ffcc;} .bnotehead {font-size:10pt; font-weight:bold;color:#66ffcc;} .email {font-size:8pt; font-weight:bold; color:white;} .fra {border:2px solid #999999; background-color:#606060;} .clsThisGame, .clsBar {font-size:8pt; font-weight:bold; color:#cccccc;} .clsBar {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff;} .clsOtherGame {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff; text-decoration:none;} .help {font-size:8pt; margin:0px; font-weight:bold;} .menubar {padding:0px; margin:0px; brder-top:1px solid white; brder-bottom:1px solid white; background-color:#606060;

         background-image:url(images/menu.gif);}

</style> <SCRIPT LANGUAGE=javascript>

</SCRIPT> </head> <body bgcolor="black" text="white" onload="init()" onmousemove="fnMouseMove()" onmouseup="fnMouseUp()"

background="images/bkg.gif">

<body bgcolor="black" text="white" onload="toggleHelp();stopGame()" background="images/bkg.gif">

JS Games!

Copyright © 2002-2004 Arun Narayanan

 

Important Note:
This game is written entirely using JavaScript. It requires Internet Explorer 5.0 or above

for proper functioning.


 Place It <input type=button id=butHelp value="Hide Help" class="but" onclick="toggleHelp()">  
  1. Choose the number of pieces for the puzzle from the drop down.
  2. Press the "Start Game" button.
  3. Drag the coloured pieces onto the black square.
  4. An option is provided to blink the pieces when placed correctly.
  5. Use the "Quit Game" button during the game to end game or to play a new game.

Recreate the square from the crazy pieces...

Choose No. of Pieces:</npan>  <select id=selLevel> <script>for (i=8;i<=20;i++) document.write("<option value="" + i + "">" + i);</script> </select>  <input class=but type=button value="Start Game" onclick="createBlocks();"> <p> <p> <p>  </center>
</div> </center>

</body> </html>


      </source>
   
  


Game PunkPong

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

   <head>
       <title>PunkPong © (by Joan Alba Maldonado)</title>
       
       <script language="JavaScript1.2" type="text/javascript">
           
       </script>
   </head>
   <body onLoad="javascript:document.getElementById("div_control").style.visibility="visible"; document.getElementById("control_teclado").checked = true; iniciar_juego();" onKeyDown="javascript:tecla_pulsada(event, "onkeypress");" onKeyPress="javascript:tecla_pulsada(event, "onkeydown");" onMouseMove="javascript:mover_raton(event);" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#aaaadd">
       









               0
               0


             Loading...


             PunkPong© by Joan Alba Maldonado
           © PunkPong 0.26a
           
  by Joan Alba Maldonado (<a href="mailto:granvino@granvino.ru;">granvino@granvino.ru</a>)  (DHTML 100%)
  - Prohibited to publish, reproduce or modify without maintain author"s name.
  * Use the keyboard arrows to move, and right arrow (also spacebar, control, shift or return)
   to fire (when is your turn).
   Under Opera, leave the mouse cursor over game zone.
   Each 3 goals you up a level and enemy are hardest.

  Dedicated to Yasmina Llaveria del Castillo </body>

</html>


      </source>
   
  


Game sudoku

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

   <head>
       <title>Yasminoku © (by Joan Alba Maldonado)</title>
       
       <script language="JavaScript1.2" type="text/javascript">
           
       </script>
   </head>
   <body onLoad="javascript:iniciar_juego_primera_vez();" onKeyPress="javascript:tecla_pulsada(event, "onkeypress");" onKeyDown="javascript:tecla_pulsada(event, "onkeydown");"  bgcolor="#efefef" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
       
see solution


try to solve


           Loading...


           Loading...


1
2
3
4
5
6
7
8
9
X
               <form id="validar" style="display:inline;">
                   <input type="button" value="Validate" name="boton_validar" style="font-size:12px; cursor: pointer; cursor: hand;" title="Verifies if sudoku are solved correctly" onClick="javascript:validar_sudoku_usuario();">
               </form>


           <form id="formulario_numeros_iniciales" style="display:inline;" onSubmit="javascript:reiniciar_juego(); return false;">
               <label for="numeros_iniciales" accesskey="q" style="cursor: pointer; cursor: hand;">
                   Qantity of initial numbers: <input type="text" name="numeros_iniciales" style="font-size:12px; font-weight:bold; color:#444444; background:#efefef; text-align:center;" id="numeros_iniciales" value="28" maxlength="2" size="2" accesskey="q">
               </label>
               <input type="button" value="Make" name="boton_crear" style="font-size:12px; cursor: pointer; cursor: hand;" title="Make a new sudoku" onClick="javascript:reiniciar_juego();">
           </form>


           © Yasminoku 0.25a by Joan Alba Maldonado (<a href="mailto:granvino@granvino.ru;">granvino@granvino.ru</a>)  (DHTML 100%)
           
  - Prohibited to publish, reproduce or modify without maintain author"s name.
  Dedicated to Yasmina Llaveria del Castillo
   </body>

</html>


      </source>
   
  


Guess Number

   <source lang="html4strict">

<html> <head> <title>!!! JS Games :: HI-LO !!!</title> <style> body,h1,h2,h3,.msg,td {font-family:Verdana,Comic Sans MS,Arial;} body {margin:0px;} h1 {font-size:28pt; font-weight:bold; margin-bottom:0px;} h2,.h2 {font-size:22pt; margin:0px; font-weight:bold; padding:0px;} h3 {font-size:8pt; margin:0px; font-weight:bold;} .msg {font-size:8pt; font-weight:bold;} .tab {cursor:hand;} .board {font-size:9pt; font-weight:bold;} .status {font-size:9pt; font-weight:bold; color:#99ff99;} .progress {font-size:8pt; font-weight:bold;} .success {font-size:14pt; font-weight:bold; color:#33ccff;} .but {font-size:8pt; font-weight:bold; height:24px; background-color:#606060; background-image:url(images/butbase.gif);

     border:0px solid #cccccc; border-left:none; border-right:none; color:white;}

.bnote {font-size:8pt; font-weight:normal;color:white;} a.notelnk,a.notelnk:visited,a.notelnk:active {font-size:8pt; font-weight:normal; color:#66ffcc;} .bnotehead {font-size:10pt; font-weight:bold;color:#66ffcc;} .email {font-size:8pt; font-weight:bold; color:white;} .fra {border:2px solid #999999; background-color:#606060;} .clsThisGame, .clsBar {font-size:8pt; font-weight:bold; color:#cccccc;} .clsBar {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff;} .clsOtherGame {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff; text-decoration:none;} .help {font-size:8pt; margin:0px; font-weight:bold;} .menubar {padding:0px; margin:0px; brder-top:1px solid white; brder-bottom:1px solid white; background-color:#606060;

         background-image:url(images/menu.gif);}

</style> <script language=javascript src="games.js"></script> <script> var gtarget, ghi, gtries, gtime, gintervalid; function toggleHelp() {

 if (butHelp.value == "Hide Help")
 {
   help.style.display = "none";
   butHelp.value = "Show Help";
 }
 else
 {
   help.style.display = "";
   butHelp.value = "Hide Help";
 }  

} //random number between low and hi function rand(low,hi) {

 return Math.floor((hi-low)*Math.random()+low); 

} //random number between 1 and hi function r1(hi) {

 return Math.floor((hi-1)*Math.random()+1); 

} function showMessage(msgstr,classname) {

 if (classname != null)
   fldStatus.innerHTML = "" + msgstr + "";
 else
   fldStatus.innerHTML = msgstr;

} function stopGame() {

 fldGuess.value = "";
 showMessage("Choose a Level and press the "Start Game" button");
 fldProgress.innerHTML = "";
 clearInterval(gintervalid);
 gintervalid=-1;
 fldHi.focus();

} function startGame() {

 gtries = 0;
 gtime = 0;
 ghi = parseInt(fldHi.value);
 gtarget = rand(0,ghi);    
 showMessage("Ok! I have guessed a number between 0 and " + ghi + "
Now make your guess!"); clearInterval(gintervalid); gintervalid = setInterval("tick()",1000); tick(); fldGuess.focus();

} function tick() {

 gtime++;
 fldProgress.innerHTML = "Tries: " + gtries + "    Time: " + gtime + " secs"

} function checkGuess() {

 if (gintervalid == -1)
 {
   alert("Please press the \"Start Game\" button to start a new game.");
   fldHi.focus();
   return;
 }
 
 if (fldGuess.value == "")
 {
   alert("Please enter your guess in the box.");
   fldGuess.focus();
   return;
 }
 
 //check if the number entered is proper
 var n = parseInt(fldGuess.value);
 
 if (isNaN(n))
 {
   alert("Please enter a valid number in the box.");
   fldGuess.focus();
   return;
 }
 
 //check range
 if (n < 0 || n > ghi)
 {
   alert("Please enter a number between 0 and " + ghi + ".");
   fldGuess.focus();
   return;
 }
 
 fldGuess.value = n; //required in case user enters alphabets after the digits
 gtries++;  
 
 if (n < gtarget)
 {
   showMessage("Your guess is lower than the number I thought of!
Choose a BIGGER number."); fldGuess.select(); return; } if (n > gtarget) { showMessage("Your guess is higher than the number I thought of!
Choose a SMALLER number."); fldGuess.select(); return; } if (n == gtarget) { stopGame(); showMessage("CONGRATS!!
You have done it in " + gtries + " tries and " + gtime + " secs!","success"); return; }

} </script> </head> <body bgcolor="black" text="white" onload="toggleHelp();stopGame()" background="images/bkg.gif"> <center>

JS Games!

Copyright © 2002-2004 Arun Narayanan

 

This game is written entirely using JavaScript. It requires Internet Explorer Version 4 or above

for proper functioning.


 HI-LO <input type=button id=butHelp value="Hide Help" class="but" onclick="toggleHelp()">  
  1. Choose a level. Press the "Start Game" button. The computer will think of a number.
  2. Make a guess by typing in a number in the box provided.
  3. Press the "Check Out" button. Repeat steps 2 and 3 until you guess the number.
  4. Tip: You can use the RETURN key instead of the buttons. Try it.

Guess the number in minimum number of tries...

<p>

Choose Level:

<select class=board id=fldHi onkeypress="if (event.keyCode==13) startGame();"> <script> var sel; for (var i=10;i<=1000000;i*=10) {

 if (i==1000) sel=" selected "; else sel=" ";
 document.writeln("<option" + sel + "value="" + i + "">" + i + "</option>");

} </script> </select>

<input class=but type=button value="Start Game" id=butStart onclick="startGame();">



Your Guess:

<input class=board type=text size="10" id=fldGuess onkeypress="if (event.keyCode==13) checkGuess();">

<input class=but width="49%" type=button value="Check Out!" onclick="checkGuess();">

</center>
</body> </html>

      </source>
   
  


HylZee

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="content-language" content="en"> <title>HylZee</title>


<meta name="author" content="peter.schaefer@gmail.ru"> <META HTTP-EQUIV="Reply-to" CONTENT="peter.schaefer@gmail.ru"> <meta name="generator" content="Code Monkey 1970.01.18(tm Peter Schaefer)"> <META NAME="description" CONTENT="HylZee - A DHTML puzzle game"> <meta name="keywords" content="HylZee DHTML javascript puzzle game huelsi tal pyr"> <META NAME="Creation_Date" CONTENT="09.10.2004"> <meta name="revisit-after" content="30 days"> <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" src="favicon.ico">


<style type="text/css"> b {font-size:16px;} .map {color:white;} .controlembossed {

       background: #66CC33;
       border-top-style:solid;
       border-right-style:solid;
       border-bottom-style:solid;
       border-left-style:solid;
       border-top-width: 1px;
       border-right-width: 1px;
       border-bottom-width: 1px;
       border-left-width: 1px;
       border-right-color: #99FF66;
       border-top-color: #99FF66;
       border-left-color: #666666;
       border-bottom-color: #666666;

} a:link { color: #99FF66; } a:hover { color: #FFFF66; } a:active { color: #FF9966; } a:visited { color: #66FF33; } table,tbody,th,td,img,span {

       margin-left: 0px;
       margin-top: 0px;
       margin-right: 0px;
       margin-bottom 0px;
       padding-left: 0px;
       padding-top: 0px;
       padding-right: 0px;
       padding-bottom: 0px;

} </style> <script language="JavaScript" type="text/JavaScript">

</script>

<script language="JavaScript" type="text/JavaScript"> // </script>


</head> <body onLoad="init();" onKeyDown="checkArrows(this,event)" style="margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;">

<center> Use the arrow keys to move. Also try "awds"-keys.
0,Q,F,1, or ^ shoots a bullet. R is restart. <A href="index.html" target="help">Help!</A> </center>

<center>

HylZee

game idea:<A href="http://www.huelsmann.net/">Roland G. Hülsmann</A>
javascript coding:<A href="mailto:peter.schafer@gmail.ru">(c)2004 Peter Schäfer</A>
level design, set A:<A href="http://www.huelsmann.net/">Roland G. Hülsmann</A>
level design, set B:<A href="mailto:peter.schafer@gmail.ru">Peter Schäfer</A>
Browsers tested: Opera7, IE5, FireFox 1.0
This software is licensed under the GPL. </center> <p>

 <form name="form_controls" method="POST" enctype="multipart/form-data" style="margin:4px 4px 4px 4px" action="javascript:loadFileFromFormname("form_controls");">
 level set:
 <select id="setname" name="setname" OnChange="javascript:loadSet(this);return false;">
       <option value="">-- choose --</option>
       <option value="B">B</option>
 </select>
 level
 <select id="levelname"  name="levelname" OnChange="javascript:loadLevel(this);return false;">
       <option value="">-- choose --</option>
 </select>
  <input type=button name="nextmap" value="next map" OnClick="javascript:

loadNextMap();">

  <input type=button id="restart" name="restart" value="restart last" OnClick="javascript:loadFrom(lastLevel);">
  <input type=button name="load" value="load" OnClick="javascript:loadFileFromFormname("form_controls");">
      <input type=reset value="reset" OnClick="javascript:return true;">
 </form>


       <iframe src="about:blank" id="scratchpadFrame" height="20" width="40"></iframe>
       

</body> </html>


      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/hylZee-001.zip">hylZee-001.zip( 182 k)</a>


Jigsaw

   <source lang="html4strict">

<html> <head> <title>!!! JS Games :: Jigsaw Puzzle !!!</title> <style> body,h1,h2,h3,.msg,capt2,td {font-family: Verdana,Comic Sans MS,Arial;} body {margin: 0px;} h1 {font-size:28pt; font-weight:bold; margin-bottom:0px;} h2,.h2 {font-size:22pt; margin:0px; font-weight:bold; padding:0px;} h3 {font-size:8pt; margin:0px; font-weight:bold;} .msg {font-size:8pt; font-weight:bold;} .capt1,.base,.bar {font-size:10pt; font-weight:bold;} .capt2 {font-size:9pt; font-weight:bold;} .capt3 {font-size:8pt; font-weight:bold;} .tip {font-size:9pt; font-weight:bold; color:#66ffcc;} .fscapt {font-size:9pt; font-weight:bold;color:#ddffdd;} .selcapt2 {font-size:9pt; font-weight:normal; margin:4px;background-color:#ddffee;color:#666655;} .selcapt3 {font-size:9pt; font-weight:normal; margin:4px;background-color:#336666;color:#ffffff;} .selcapt {font-size:9pt; font-weight:normal; margin:4px;background-color:#ffffff;color:#006600;} .but {font-size:8pt; font-weight:bold; height:24px; background-color:#606060;color:#ffffff;background-image:url(images/butbase.gif);border:0px solid #cccccc; border-left:none; border-right:none;} .base {background-color:#aaff66;border:1px solid #009900;color:#006600;} .bar {background-image:url(jigsaw/bar.gif);background-color:#336633;color:#00330;text-align:center;} .url,.urlp,.urla {font-size:8pt; font-weight:bold;color:#ffffaa} .urlp {color:#aaffaa} .urla {color:#66eeff} .info {border:2px;border-style:solid;border-color:white;} .bnote {font-size:8pt; font-weight:normal;color:white;} a.notelnk,a.notelnk:visited,a.notelnk:active {font-size:8pt; font-weight:normal; color:#66ffcc;} .bnotehead {font-size:10pt; font-weight:bold;color:#66ffcc;} .email {font-size:8pt; font-weight:bold; color:white;} .menubar {padding:0px; margin:0px; brder-top:1px solid white; brder-bottom:1px solid white; background-color:#606060;

         background-image:url(images/menu.gif);}

.fra {border:2px solid #999999; background-color:#606060;} .clsThisGame, .clsBar {font-size:8pt; font-weight:bold; color:#cccccc;} .clsBar {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff;} .clsOtherGame {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff; text-decoration:none;} .help {font-size:8pt; margin:0px; font-weight:bold;} </style> <script language="javascript">

</script> <script language=vbscript> Function VBMsgBox(prompt,buttons,title)

 VBMsgBox = MsgBox(prompt,buttons,title)
 

End Function </script> </head> <body bgcolor="black" text="white" onload="init()" background="images/bkg.gif"> <center>

JS Games!

Copyright © 2002-2004 Arun Narayanan
<a class=notelnk href="http://jsgames.sourceforge.net/">http://jsgames.sourceforge.net/</a>
 

Important Note:
This game is written using Advanced JavaScript. It requires Internet Explorer Version 5 or above

for proper functioning.

<a href="http://www.microsoft.ru/windows/ie/" target="_blank"><img border="0" src="images/ie.gif" alt="Download Internet Explorer"></a>


 Jigsaw Puzzle <input type=button id=butHelp value="Hide Help" class="but" onclick="toggleHelp()">  
  1. Select a Picture from the list.
  2. Select "MY OWN URL" option to specify your own Picture URL.
  3. Select "MY LOCAL FILE" option to play the jigsaw puzzle with a file in your machine or network.
  4. The game board has blocks with pieces of the picture in it.
  5. The objective of the game is to order the pictures to form the original picture.
  6. To move any piece to a particular location, drag the piece using the mouse over the piece at that location. The images get swapped.
  7. Press the "Start Game" button. The timer would be started.

Complete the picture in the shortest time possible with a minimum number of moves...

<p>

     <fieldset>
     <legend class=fscapt align=center>PICTURE</legend>
     <select id=selPic class=selcapt onchange="checkSelection()">
       <option value="myurl">- MY OWN URL -</option>
       <option value="localfile">- MY LOCAL FILE -</option>
       <option value="" selected>- Select a Picture -</option>
       <option value="car.jpg">Red Car</option>
       <option value="mickeybw.gif">Mickey Mouse</option>
       <option value="nature.jpg">Nature</option>
       <option value="cartoon.jpg">Cartoon</option>
       <option value="poo.jpg">Winnie the POO</option>
       <option value="watertap.jpg">Water Tap</option>
       <option value="alps.jpg">Mountains</option>
     </select>
     </fieldset>
     <fieldset>
     <legend class=fscapt align=center>ROWS</legend>
     <select id=selRows class=selcapt>
       <option value=1>1</option>
       <option value=2>2</option>  
       <option value=3>3</option>
       <option value=4 selected>4</option>  
       <option value=5>5</option>
       <option value=6>6</option>  
       <option value=7>7</option>
       <option value=8>8</option>  
       <option value=9>9</option>
       <option value=10>10</option>  
       <option value=11>11</option>
       <option value=12>12</option>  
     </select>
     </fieldset>
     <fieldset>
     <legend class=fscapt align=center>COLS</legend>
     <select id=selCols class=selcapt>
       <option value=1>1</option>
       <option value=2>2</option>  
       <option value=3>3</option>
       <option value=4 selected>4</option>  
       <option value=5>5</option>
       <option value=6>6</option>  
       <option value=7>7</option>
       <option value=8>8</option>  
       <option value=9>9</option>
       <option value=10>10</option>  
       <option value=11>11</option>
       <option value=12>12</option>  
     </select>
     </fieldset>
     <input type=button class=but name=butLoad value="Load Picture" disabled onclick="checkPicture();">
        
     <input type=button class=but name=butStart value="Start Game" disabled onclick="startGame();">
 <marquee width=300 loop=4>
   Select a Picture for the Jigsaw Puzzle from the drop down above.
 </marquee>



To pass parameters using the URL itself, use one of the following two URL formats:
  1. http://jsgames.sourceforge.net/jusgames.html?url=http://yoursite.ru/img.jpg
  2. http://jsgames.sourceforge.net/jigsaw.html?url=http://yoursite.ru/img.jpg&rows=5&cols=3

</center>

</center>

</body> </html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/JavaScriptGame.zip">JavaScriptGame.zip( 115 k)</a>


js mine sweeper

<A href="http://www.wbex.ru/Code/JavaScriptDownload/jsminesweeper-0.1.5.zip">jsminesweeper-0.1.5.zip( 68 k)</a>

1. <A href="/Code/JavaScript/Page-Components/ChessDraughts.htm">Chess: Draughts</a> <A href="/Code/JavaScript/Page-Components/ChessDraughts.htm"></a> 2. <A href="/Code/JavaScript/Page-Components/Minegame.htm">Mine game</a> <A href="/Code/JavaScript/Page-Components/Minegame.htm"></a> 3. <A href="/Code/JavaScript/Page-Components/Wordsearchgame.htm">Word search game</a> <A href="/Code/JavaScript/Page-Components/Wordsearchgame.htm"></a> 4. <A href="/Code/JavaScript/Page-Components/Ranisimaenglish.htm">Ranisima english</a> <A href="/Code/JavaScript/Page-Components/Ranisimaenglish.htm"></a> 5. <A href="/Code/JavaScript/Page-Components/YasminurobanbyJoanAlbaMaldonado.htm">Yasminuroban (by Joan Alba Maldonado)</a> <A href="/Code/JavaScript/Page-Components/YasminurobanbyJoanAlbaMaldonado.htm"></a> 6. <A href="/Code/JavaScript/Page-Components/LeveleditorforYasminurobanbyJoanAlbaMaldonado.htm">Level editor for Yasminuroban by Joan Alba Maldonado</a> <A href="/Code/JavaScript/Page-Components/LeveleditorforYasminurobanbyJoanAlbaMaldonado.htm"></a> 7. <A href="/Code/JavaScript/Page-Components/Anothertictactoe.htm">Another tictactoe</a> <A href="/Code/JavaScript/Page-Components/Anothertictactoe.htm"></a> 8. <A href="/Code/JavaScript/Page-Components/Marbles.htm">Marbles</a> <A href="/Code/JavaScript/Page-Components/Marbles.htm"></a> 9. <A href="/Code/JavaScript/Page-Components/Jigsaw.htm">Jigsaw</a> <A href="/Code/JavaScript/Page-Components/Jigsaw.htm"></a> 10. <A href="/Code/JavaScript/Page-Components/Gamesudoku.htm">Game sudoku</a> 11. <A href="/Code/JavaScript/Page-Components/GamePunkPong.htm">Game PunkPong</a> 12. <A href="/Code/JavaScript/Page-Components/TetrisinJavascript.htm">Tetris in Javascript</a> 13. <A href="/Code/JavaScript/Page-Components/ArrangeGame.htm">Arrange Game</a> 14. <A href="/Code/JavaScript/Page-Components/GuessNumber.htm">Guess Number</a> 15. <A href="/Code/JavaScript/Page-Components/Tictactoe.htm">Tic tac toe</a> <A href="/Code/JavaScript/Page-Components/Tictactoe.htm"></a> 16. <A href="/Code/JavaScript/Page-Components/CountGame.htm">Count Game</a> 17. <A href="/Code/JavaScript/Page-Components/AJavaScriptHangmanGame.htm"> A JavaScript Hangman Game</a> 18. <A href="/Code/JavaScript/Page-Components/Gamelibrary.htm">Game library</a> <A href="/Code/JavaScript/Page-Components/Gamelibrary.htm"></a> 19. <A href="/Code/JavaScript/Page-Components/TypeTutor.htm">Type Tutor</a> 20. <A href="/Code/JavaScript/Page-Components/GamePlaceItIEonly.htm">Game: Place It (IE only)</a> 21. <A href="/Code/JavaScript/Page-Components/HylZee.htm">HylZee</a> <A href="/Code/JavaScript/Page-Components/HylZee.htm"></a>

Level editor for Yasminuroban by Joan Alba Maldonado

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

   <head>
       <title>Level editor for Yasminuroban © by Joan Alba Maldonado</title>
       
       <script language="JavaScript1.2" type="text/javascript">
           
       </script>
   </head>
   <body bgcolor="#ffffff" onLoad="javascript:document.getElementById("mensaje_espera").style.visibility="visible"; setTimeout("iniciar_editor(); recoger_mapa_url(); document.getElementById(\"mensaje_espera\").style.visibility=\"hidden\"", 10);">
       
  Loading... Please, wait.  
           Choose an image:
           <img src="img/yas_down1.gif" width="40" height="40" hspace="0" vspace="0" title="Click here to select" alt="personage" id="imagen_personaje">
           <img src="img/yas_copa_editor.gif" width="40" height="40" hspace="0" vspace="0" title="Click here to select" alt="personage over empty glass (empty hole)" id="imagen_personaje_copa">
           <img src="img/piedra1.gif" width="40" height="40" hspace="0" vspace="0" title="Click here to select" alt="stone (brick)" id="imagen_pared">
           <img src="img/copa1.gif" width="40" height="40" hspace="0" vspace="0" title="Click here to select" alt="empty glass (empty hole)" id="imagen_agujero_vacio">
           <img src="img/copa2.gif" width="40" height="40" hspace="0" vspace="0" title="Click here to select" alt="full glass (full hole)" id="imagen_agujero_lleno">
           <img src="img/botella.gif" width="40" height="40" hspace="0" vspace="0" title="Click here to select" alt="bottle (piece)" id="imagen_pieza">
           <img src="img/borrar.gif" width="40" height="40" hspace="0" vspace="0" title="Click here to select" alt="delete (eraser)" id="imagen_borrar">


Map:
[ <a href="" style="color:#ff0000;">Clear map</a> - <a href="" style="color:#ff0000;">Play map</a> ]


   </body>

</html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/yasminuroban_english.zip">yasminuroban_english.zip( 49 k)</a>


Marbles

   <source lang="html4strict">


<html> <head> <title>!!! JS Games :: Marbles !!!</title> <style> body,h1,h2,h3,.msg,td {font-family:Verdana,Comic Sans MS,Arial;} body {margin:0px;} .bnote {font-size:8pt; font-weight:normal;color:white;} a.notelnk,a.notelnk:visited,a.notelnk:active {font-size:8pt; font-weight:normal; color:#66ffcc;} .bnotehead {font-size:10pt; font-weight:bold;color:#66ffcc;} .email {font-size:8pt; font-weight:bold; color:white;} .fra {border:2px solid #999999; background-color:#606060;} .clsThisGame, .clsBar {font-size:8pt; font-weight:bold; color:#cccccc;} .clsBar {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff;} .clsOtherGame {margin:0px; font-size:8pt; font-weight:bold; color:#ffffff; text-decoration:none;} .menubar {padding:0px; margin:0px; brder-top:1px solid white; brder-bottom:1px solid white; background-color:#606060; background-image:url(images/menu.gif);} .msg {font-size:8pt; font-weight:bold;}

.info {font-family:Arial; font-size:8pt; color:#C0FFC0; font-weight:bold;} .score {font-family:Arial; font-size:12pt; color:#ffffff; font-weight:bold;} .button {font-family:Arial; font-size:8pt; background-color:#5581FF; color:#ffffff; font-weight:bold; text-align:center;} .elapsed {font-family:Arial; font-size:12pt; color:#ffFF00; font-weight:bold;} </style> <script> var INVALID=0, MARBLE=1, HOLE=2; var a = new Array( 0,0,0,0,0,0,0,0,0, 0,0,0,1,1,1,0,0,0, 0,0,0,1,1,1,0,0,0, 0,1,1,1,1,1,1,1,0, 0,1,1,1,2,1,1,1,0, 0,1,1,1,1,1,1,1,0, 0,0,0,1,1,1,0,0,0, 0,0,0,1,1,1,0,0,0, 0,0,0,0,0,0,0,0,0 ); var b = new Array(); var marbles_left = 32; var currcell = -1; var gintervalid = -1, gtime = 0; var game_over = true; function tick() {

 elapsed.innerHTML = gtime + " sec" + (gtime==1?"":"s");
 gtime++;

} function copyArray(src,dest) {

 for(var ii=0;ii<src.length;ii++) dest[ii]=src[ii];

} function cell(i) {

 return eval("c" + i);

} function cellxy(x,y) {

 return eval("c" + (y * 9 + x) );

} function setHilite(i) {

 cell(i).src = "marbles/marble_hilite.gif";  

} function setMarble(i) {

 cell(i).src = "marbles/marble_hole.gif";  

} function setHole(i) {

 cell(i).src = "marbles/hole.gif";  

} function move(src,middle,dest) {

 var msgs = new Array("Hey, that"s a lazy game! You need more practice!",
                      "WOW! You cleared all the marbles!\nYou must be a Genius!!",
                      "That"s a great show!\nYou"re brilliant!",
                      "Good show! You are intelligent.\n" +
                      "A little more effort and you"ll be at the top!",
                      "Hmmm, not bad! But I"m sure you can do better!",
                      "You surely can improve! Learn the tricks as you go!");
 setHole(src);
 setHole(middle);
 setMarble(dest);
 b[src] = b[middle] = HOLE;
 b[dest] = MARBLE;
 currcell = -1;
 marbles_left--;
 score.innerHTML = marbles_left + "/32";
 game_over = isGameOver();
 if (game_over)
 {
   clearInterval(gintervalid);
   gintervalid = -1;
   newbut.value = "S T A R T";
   alert("********* !! G A M E   O V E R !! *********\n\n" +
         ((marbles_left > 5) ? msgs[0] : msgs[marbles_left]) + "\n\n" +
         "No. of marbles left: " + marbles_left + "\n" +
         "Time Elapsed: " + gtime + " secs"
        );
   gtime = 0;
 }

} function canMove(n) {

   if (b[n] != MARBLE) return false;
   //does a marble plus hole combination exists left, right, up or down?
   return (b[n-2]==HOLE && b[n-1]==MARBLE) ||
          (b[n+2]==HOLE && b[n+1]==MARBLE) ||
          (b[n-18]==HOLE && b[n-9]==MARBLE) ||
          (b[n+18]==HOLE && b[n+9]==MARBLE);

} function isGameOver() {

 var moveable = false;
 for(y=1;y<8;y++)
   for(x=1;x<8;x++)
     if (canMove(y * 9 + x)) return false;
 return true;

} function hit(n) {

 if (gintervalid == -1) //if game is not running, start it
 {
   gintervalid = setInterval("tick()",1000);
   tick();
   newbut.value = "S T O P !";
 }
 if (b[n] == MARBLE)
 {
   if (currcell!=-1) setMarble(currcell);
   setHilite(n);
   currcell = n;
 }
 if (b[n] == HOLE)
 {
   if (currcell == -1)
   {
     alert("Please select a marble to move");
     return;
   }
   if (currcell - n == 2) move(currcell,n+1,n);     
   else if (n - currcell == 2) move(currcell,n-1,n);
   else if (n - currcell == 18) move(currcell,n-9,n);     
   else if (currcell - n == 18) move(currcell,n+9,n);
   else alert("Sorry. Invalid move!\n\n" +
              "You can move the selected marble only to\n" +
              "a hole that is exactly one marble away.\n\n" +
              "Diagonal moves are not allowed.");
 }

} function dropped() {

 var imgid = document.elementFromPoint(event.clientX,event.clientY).id;
 
 var d = imgid.match(/c(\d+)/); //extract value for i from the cell id
 if (d != null) hit(parseInt(d[1]));

} function newGame() {

 if (gintervalid==-1) //game is stopped, so start it.
 {
   if (game_over || (gtime != 0 && !confirm("Do you wish to continue with the old game?\n\nClick "Cancel" to start a new game.")))
   {
     gtime = 0;    
     boardarea.innerHTML=drawBoard();
     game_over = false;
   }
   gintervalid = setInterval("tick()",1000);
   tick();
   newbut.value = "S T O P !";
 }
 else //game running, stop it
 {
   //stop it!
   clearInterval(gintervalid);
   gintervalid = -1;
   newbut.value = "S T A R T";
 }

} function drawBoard() {

 var i, x, y, s, func;
 copyArray(a,b);
 
 marbles_left = 32;
s = ""; for(y=1;y<8;y++) { s += ""; for(x=1;x<8;x++) { i = y * 9 + x; func = "onmousedown="hit(" + i + ")"" + " ondragend="dropped()""; if (i==10 || i == 16 || i==55 || i==60) { s += ""; } else if (b[i] != INVALID) { s += ""; } } s += ""; } s += "
";
       if (i == 60) 
s += "" + "" + "" + /* "" + */ "
Marbles Left:
32/32
 
 
" +
              "<input id=newbut type=button class=button value="S T A R T" onclick="newGame()">" +
"
"; s += "
";
       if (b[i]==MARBLE) s += "<img id=c" + i + " src="marbles/marble_hole.gif" " + func + ">";
       if (b[i]==HOLE) s += "<img id=c" + i + " src="marbles/hole.gif" " + func + ">";
s += "
";
 return s;

} </script> </head> <body bgcolor="black" text="white" background="images/bkg.gif"

     onload="boardarea.innerHTML=drawBoard();">

<center>

JS Games!

Copyright © 2002-2004 Arun Narayanan
<a class=notelnk href="http://jsgames.sourceforge.net/">http://jsgames.sourceforge.net/</a>
 

Important Note:
This game is written entirely using JavaScript. It requires Internet Explorer Version 4 or above

for proper functioning.

<a href="http://www.microsoft.ru/windows/ie/" target="_blank"><img border="0" src="images/ie.gif" alt="Download Internet Explorer"></a>


<p> </center>
</body> </html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/JavaScriptGame.zip">JavaScriptGame.zip( 115 k)</a>


Mine game

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

   <head>
       <title>Buscayasminas © (by Joan Alba Maldonado)</title>
       
       <script language="JavaScript1.2" type="text/javascript">
           
       </script>
   </head>
   <body onLoad="iniciar_juego_primera_vez();" onMouseMove="javascript:arrastrar_ventana(event);" onMouseUp="javascript:arrastrar_opciones=false;" onClick="campo_seleccionable=false; arrastrar_opciones=false;" onKeyDown="javascript:tecla_pulsada(event, true);" onKeyUp="javascript:tecla_pulsada(event, false);" bgcolor="#efdddd" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
       


Loading...



<img src="img/yasmina_click.gif">
<img src="img/yasmina_win.gif">
<img src="img/yasmina_lose.gif">
<img src="img/yasmina.gif">
<img src="img/bandera.gif">
<img src="img/bandera_no.gif">


           © Buscayasminas 0.30a by Joan Alba Maldonado (<a href="mailto:granvino@granvino.ru;">granvino@granvino.ru</a>)  (DHTML 100%)
           
  - Prohibited to publish, reproduce or modify without maintain author"s name.
  Dedicated to Yasmina Llaveria del Castillo </body>

</html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/buscayasminas_english.zip">buscayasminas_english.zip( 16 k)</a>


Ranisima english

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

   <head>
       <title>La Ranísima © (by Joan Alba Maldonado)</title>
       
       <script language="JavaScript1.2" type="text/javascript">
           
       </script>
   </head>
   <body onLoad="javascript:iniciar_juego();" onKeyPress="javascript:tecla_pulsada(event, "onkeypress");" onKeyDown="javascript:tecla_pulsada(event, "onkeydown");" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#eeeeee">
       
                   <img src="imagenes/sol.gif" width="80" height="80" hspace="0" vspace="0" name="sol_imagen" style="filter:alpha(opacity=80); opacity:0.8; -moz-opacity:0.8;">



               <img src="imagenes/seta.gif" width="40" height="40" hspace="0" vspace="0" name="seta_imagen">



               <img src="imagenes/rana1.gif" width="40" height="40" hspace="0" vspace="0" name="personaje_imagen">


               <img src="imagenes/mosca1.gif" width="40" height="40" hspace="0" vspace="0" name="enemigo1_imagen">
               <img src="imagenes/mosca1.gif" width="40" height="40" hspace="0" vspace="0" name="enemigo2_imagen">
               <img src="imagenes/mosca1.gif" width="40" height="40" hspace="0" vspace="0" name="enemigo3_imagen">
               <img src="imagenes/mosca1.gif" width="40" height="40" hspace="0" vspace="0" name="enemigo4_imagen">
               <img src="imagenes/mosca1.gif" width="40" height="40" hspace="0" vspace="0" name="enemigo5_imagen">
               <img src="imagenes/mosca1.gif" width="40" height="40" hspace="0" vspace="0" name="enemigo6_imagen">


               You are here


             Loading parameters...
             La Ranísima© by Joan Alba Maldonado


           © La Ranísima 0.96a
           
  by Joan Alba Maldonado (<a href="mailto:granvino@granvino.ru;">granvino@granvino.ru</a>)  (DHTML 100%)
  - Prohibited to publish, reproduce or modify without maintain original
    author"s name
  * Use the keyboard arrows to move, and spacebar (also control, shift
   or return) to fire. Under Opera, leave the mouse cursor over game zone.

  Dedicated to Yasmina Llaveria del Castillo
   </body>

</html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/ranisima_english.zip">ranisima_english.zip( 21 k)</a>


Tetris in Javascript

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

   <head>
       <title>Tetríssimus © (by Joan Alba Maldonado)</title>
       
       <script language="JavaScript1.2" type="text/javascript">
           
       </script>
   </head>
   <body onLoad="javascript:activar_desactivar_mapa_debug("mantener"); iniciar_juego();" onKeyDown="javascript:pulsar_tecla(event, "onkeypress");" onKeyPress="javascript:pulsar_tecla(event, "onkeydown");" bgcolor="#eeeeff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
       



               Loading...


           Loading...


             Loading...
           Tetríssimus© by Joan Alba Maldonado


           <form name="formulario" id="formulario" style="display:inline;">
               <label for="casilla" title="Shows map on debug mode (text)" accesskey="m">
                   <input type="checkbox" name="casilla" id="casilla" onClick="javascript:activar_desactivar_mapa_debug("alternar");" checked> Show debug mode map  
               </label>
           </form>


           [ Pause ]


           © Tetríssimus 0.15a
           
  by Joan Alba Maldonado (<a href="mailto:granvino@granvino.ru;">granvino@granvino.ru</a>)  (100% DHTML)
  - Prohibited to publish, reproduce or modify without maintain author"s name.
  * Use the keyboard arrow to move, and up arrow (also spacebar, control,
   shift or return) to rotate piece. Under Opera, leave the mouse cursor
   over game zone.

  Dedicated to Yasmina Llaveria del Castillo </body>

</html>

      </source>
   
  


Tic tac toe

   <source lang="html4strict">
      

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>Tic Tac Toe</title>

<style rel="stylesheet"> .main{background:#FFFFFF; border:#000000 solid 1px; width:400px} .header{background:#000000; width:100%} .ip{border:#000000 solid 1px; width:50px; height:20px} .btn{border:#000000 solid 1px; font-weight:bold; height:20px; cursor:hand} .content_cpy{font-family:verdana,arial,helvetica; font-size:8pt; color:#FFFFFF} .link{font-family:verdana,arial,helvetica; font-size:8pt; color:#FFFFFF} .link:hover{font-family:verdana,arial,helvetica; font-size:8pt; color:#99FF00} .nav{font-family:verdana,arial; font-size:8pt; font-weight:bold;

    border-right:#000000 solid 2px; border-left:#000000 solid 1px; 
    border-bottom:#000000 solid 2px; border-top:#000000 solid 1px; 
    background:#FFFFFF; height:20px; cursor:hand}

.nav_over{font-family:verdana,arial; font-size:8pt; font-weight:bold;

         border-right:#000000 solid 1px; border-left:#000000 solid 2px; 
         border-bottom:#000000 solid 1px; border-top:#000000 solid 2px; 
         background:#FFFFFF; height:20px; cursor:hand}

</style> </head> <body bgcolor="#ffffff">

<tbody></tbody>
<img src="head_ttt.gif">
<tbody></tbody>
<tbody></tbody>
<tbody></tbody>


<script language="JavaScript"> ///////////////////////////////////////////////////////////////// // // Tic-Tac-Toe JavaScript // By Premshree Pillai // Created : 04/10/02 (dd/mm/yy) // Web : http://www.qiksearch.ru // http://javascript.qik.cjb.net // E-mail : qiksearch@rediffmail.ru // jsfx@rediffmail.ru // // Like the script ? // Sign my Guestbook : // - http://pub.alxnet.ru/guestbook?id=2395118 // // Use freely as long as all credits are reatained // and all contents are as it is. // // CopyRight 2002 Premshree Pillai. All rights reserved. // Do not modify anything below this! // ///////////////////////////////////////////////////////////////// /* Global Variables */ ///////////////////////////////////////////////////////////////// var playerToken="1"; var myToken="0"; var MAXSIZE=100; var _def_size=60; var _def_bg_color="#000000"; var _def_color="#FFFFFF"; var _def_exit_msg="
<input type="button" class="btn" value="Play Again!" onClick="location.reload();">"; var isEmptyArr=new Array(MAXSIZE); for(var i=0; i<isEmptyArr.length; i++)

 isEmptyArr[i]=true;

var drawCounter=0; /* Arrays for testing */ var rowArr=new Array(); for(var i=0; i<=MAXSIZE; i++)

 rowArr[i]=0;

var colArr=new Array(); for(var i=0; i<=MAXSIZE; i++)

 colArr[i]=0;

var digArr=new Array(); for(var i=0; i<=MAXSIZE; i++)

 digArr[i]=-1;

var lostFlag=false; var meFirst=false; ///////////////////////////////////////////////////////////////// /* Reset Global Variables */ function flush() {

 isEmptyArr=new Array(MAXSIZE);
 for(var i=0; i<isEmptyArr.length; i++)
   isEmptyArr[i]=true;
 rowArr=new Array();
 for(var i=0; i<=MAXSIZE; i++)
   rowArr[i]=0;
 colArr=new Array();
 for(var i=0; i<=MAXSIZE; i++)
   colArr[i]=0;
 digArr=new Array();
 for(var i=0; i<=MAXSIZE; i++)
   digArr[i]=-1;
 drawCounter=0;
 lostFlag=false;

} /* Generate the Board */ function genBox(size,where) {

 var count=0;
var retVal="
"; for(var i=0; i<size; i++) { retVal+=""; for(var j=0; j<size; j++) { count++; var id=new String("id"+count); retVal+="";
   }
retVal+=""; } retVal+="
";
 document.getElementById(where).innerHTML=retVal;
 if(isNaN(size))
 {
   alert("Please enter a valid number!");
   document.getElementById(where).innerHTML=_def_exit_msg;
 }

} /* Insert Token */ function insert(what,id,size) {

 var ids=id.split("id");
 if(isEmpty(id))
 {
   drawCounter++;
   document.getElementById(id).innerHTML=what;
   isEmptyArr[ids[1]]=false;
   if(what==playerToken)
     if((!playerWin(size))&&(!checkWin(size)))
       move(size);
 }
 else
   alert("You cannot insert here!");
 if((drawCounter==size*size)&&!lostFlag)
 {
   if((!checkWin(size))&&(!playerWin(size)))
   {
     alert("It\"s a Draw!!!");
     if(confirm("Do you want to play again ?"))
     {
       flush();
       resolveMove(size);
     }
     else
       document.getElementById("container").innerHTML=_def_exit_msg;
   }
 }

} /* Computer"s Move! */ function move(size) {

 var count=0;
 var maxCount=0;
 /* Building the Row Array */
 for(var i=1; i<=size; i++)
 {
   maxCount=0;
   for(var j=1; j<=size; j++)
   {
     count++;
     var id=new String("id"+count);
     if(!isEmpty(id))
       if(document.getElementById(id).innerHTML==playerToken)
         maxCount++;
   }
   rowArr[i]=maxCount;
 }
 /* Building the Column Array */
 for(var i=1; i<=size; i++)
 {
   count=i;
   maxCount=0;
   for(var j=1; j<=size; j++)
   {
     var id=new String("id"+count);
     if(!isEmpty(id))
     {
       if(document.getElementById(id).innerHTML==playerToken)
         maxCount++;
     }
     count+=size;
   }
   colArr[i]=maxCount;
 }
 /* Building the Diagonal Array */
 for(var i=1; i<=2; i++)
 {
   if(i==1)
     count=i;
   else
     count=size;
   maxCount=0;
   for(var j=1; j<=size; j++)
   {
     var id=new String("id"+count);
     if(!isEmpty(id))
     {
       if(document.getElementById(id).innerHTML==playerToken)
         maxCount++;
     }
     if(i==1)
       count+=size+1;
     else
       count+=size-1;
   }
   digArr[i]=maxCount;
 }
 /* Finding max values */
 var maxRow=max(rowArr,0,size,"row");
 var maxCol=max(colArr,0,size,"col");
 var maxDig=max(digArr,0,size,"dig");
 var maxArrs=new Array(-1,max(rowArr,1,size,"row"),max(colArr,1,size,"col"),max(digArr,1,size,"dig"));
 if(max(maxArrs,0,size,"x")==1)
   count=size*maxRow-size+1;
 if(max(maxArrs,0,size,"x")==2)
   count=maxCol;
 if(max(maxArrs,0,size,"x")==3)
 {
   if(maxDig==1)
     count=maxDig;
   else
     count=size;
 }
 if(!firstMove(size))
 {
   for(var i=1; i<=size; i++)
   {
     var id=new String("id"+count);
     if(isEmpty(id))
     {
       insert(myToken,id,size);
       break;
     }
     if(max(maxArrs,0,size,"x")==1)
       count++;
     if(max(maxArrs,0,size,"x")==2)
       count+=size;
     if(max(maxArrs,0,size,"x")==3)
     {
       if(maxDig==1)
         count+=size+1;
       else
         count+=size-1;
     }
   }
 }
 else
 {
   playFirst(size);
 }
 if(playerWin(size))
 {
   alert("WOW! You Won!!!");
   if(confirm("Do you want to play again ?"))
   {
     flush();
     resolveMove(size);
   }
   else
     document.getElementById("container").innerHTML=_def_exit_msg;
   lostFlag=true;
 }
 else
 {
   if(checkWin(size))
   {
     alert("OOPS! You lost!!!");
     if(confirm("Do you want to play again ?"))
     {
       flush();
       resolveMove(size);
     }
     else
       document.getElementById("container").innerHTML=_def_exit_msg;
     lostFlag=true;
   }
 }

} function max(arr,what,size,type) {

 var max=-1,maxIndex=-1;
 for(var i=1; i<=size; i++)
 {
   if(type=="x")
   {
     if(arr[i] > max)
     {
       max=arr[i];
       maxIndex=i;
     }
   }
   else
   {
     if(!isFull(type,i,size) && type!="dig")
     {
       if(arr[ i ] > max)
       {
         max=arr[i];
         maxIndex=i;
       }
     }
   }
 }
 if(type=="dig")
 {
   for(var i=1; i<=2; i++)
   {
     if(!isFull(type,i,size))
     {
       if(arr[i] > max)
       {
         max=arr[i];
         maxIndex=i;
       }
     }
   }
 }
 if(what==0)
   return(maxIndex);
 else
   return(max);

} function isEmpty(who) {

 who=who.split("id");
 return(isEmptyArr[who[1]]);

} function isFull(type,num,size) {

 var retVal,count=1;
 if(type=="row")
 {
   count=size*num-size+1;
   for(var i=1; i<=size; i++)
   {
     var id=new String("id"+count);
     if(isEmpty(id))
     {
       retVal=false;
       return false;
       break;
     }
     else
       retVal=true;
     count++;
   }
 }
 if(type=="col")
 {
   count=num;
   for(var i=1; i<=size; i++)
   {
     var id=new String("id"+count);
     if(isEmpty(id))
     {
       retVal=false
       return false;
       break;
     }
     else
       retVal=true;
     count+=size;
   }
 }
 if(type=="dig")
 {
   if(num==1)
     count=num;
   else
     count=size;
   for(var i=1; i<=size; i++)
   {
     var id=new String("id"+count);
     if(isEmpty(id))
     {
       retVal=false
       return false;
       break;
     }
     else
       retVal=true;
     if(num==1)
       count+=size+1;
     else
       count+=size-1;
   }
 }
 return(retVal);

} function firstMove(size) {

 var count=0;
 for(var i=1; i<=size*size; i++)
 {
   var id=new String("id"+i);
   if(!isEmpty(id))
     count++;
 }
 if(count<=1)
   return true;
 else
   return false;

} function playFirst(size) {

 if(size%2!=0)
 {
   var tempNum=Math.floor(size*size/2)+1;
   var id=new String("id"+tempNum);
   if(isEmpty(id))
     insert(myToken,id,size);
   else
   {
     tempNum+=size+1;
     id=new String("id"+tempNum);
     insert(myToken,id,size);
   }
 }
 else
 {
   var temp=max(digArr,0,size,"dig");
   if(temp==1)
     count=temp;
   else
     count=size;
   for(var i=1; i<=size; i++)
   {
     var id=new String("id"+count);
     if(isEmpty(id))
     {
       insert(myToken,id,size);
       break;
     }
     if(temp==1)
       count+=size+1;
     else
       count+=size-1;
   }
 }

} function checkWin(size) {

 var myRowArr=new Array();
 var myColArr=new Array();
 var myDigArr=new Array();
 var maxCount,count=0;
 /* Building My Row Array */
 for(var i=1; i<=size; i++)
 {
   maxCount=0;
   for(var j=1; j<=size; j++)
   {
     count++;
     var id=new String("id"+count);
     if(!isEmpty(id))
       if(document.getElementById(id).innerHTML==myToken)
         maxCount++;
   }
   myRowArr[i]=maxCount;
 }
 /* Building My Column Array */
 for(var i=1; i<=size; i++)
 {
   count=i;
   maxCount=0;
   for(var j=1; j<=size; j++)
   {
     var id=new String("id"+count);
     if(!isEmpty(id))
     {
       if(document.getElementById(id).innerHTML==myToken)
         maxCount++;
     }
     count+=size;
   }
   myColArr[i]=maxCount;
 }
 /* Building My Diagonal Array */
 for(var i=1; i<=2; i++)
 {
   if(i==1)
     count=i;
   else
     count=size;
   maxCount=0;
   for(var j=1; j<=size; j++)
   {
     var id=new String("id"+count);
     if(!isEmpty(id))
     {
       if(document.getElementById(id).innerHTML==myToken)
         maxCount++;
     }
     if(i==1)
       count+=size+1;
     else
       count+=size-1;
   }
   myDigArr[i]=maxCount;
 }
 var myMaxRow=myMax(myRowArr,0,size);
 var myMaxCol=myMax(myColArr,0,size);
 var myMaxDig=myMax(myDigArr,0,size);
 var myMaxArrs=new Array(-1,myMax(myRowArr,1,size),myMax(myColArr,1,size),myMax(myDigArr,1,size));
 if(myMax(myMaxArrs,1,size)==size)
 {
   var blinkWho=myMax(myMaxArrs,0,size);
   var blinkNum;
   if(blinkWho==1)
     blinkNum=myMaxRow;
   if(blinkWho==2)
     blinkNum=myMaxCol;
   if(blinkWho==3)
     blinkNum=myMaxDig;
   blink(blinkWho,blinkNum,size,"#FF0000");
   return true;
 }
 else
   return false;

} function myMax(arr,what,size) {

 var max=-1,maxIndex=-1;
 for(var i=1; i<=size; i++)
 {
   if(arr[i] > max)
   {
     max=arr[i];
     maxIndex=i;
   }
 }
 if(what==0)
   return(maxIndex);
 else
   return(max);

} function blink(who,num,size,color) {

 var count;
 if(who==1)
   count=size*num-size+1;
 if(who==2)
   count=num;
 if(who==3)
 {
   if(num==1)
     count=num;
   else
     count=size;
 }
 for(var i=1; i<=size; i++)
 {
   var id=new String("id"+count);
   document.getElementById(id).style.color=color;
   if(who==1)
     count++;
   if(who==2)
     count+=size;
   if(who==3)
   {
     if(num==1)
       count+=size+1;
     else
       count+=size-1;
   }
 }

} /* Check if player wins */ function playerWin(size) {

 var maxRow=myMax(rowArr,0,size);
 var maxCol=myMax(colArr,0,size);
 var maxDig=myMax(digArr,0,size);
 var maxArrs=new Array(-1,myMax(rowArr,1,size),myMax(colArr,1,size),myMax(digArr,1,size));
 if(myMax(maxArrs,1,size)==size)
 {
   var blinkWho=myMax(maxArrs,0,size);
   var blinkNum;
   if(blinkWho==1)
     blinkNum=maxRow;
   if(blinkWho==2)
     blinkNum=maxCol;
   if(blinkWho==3)
     blinkNum=maxDig;
   blink(blinkWho,blinkNum,size,"#00FF00");
   return true;
 }
 else
   return false;

} function doGen() {

 var puts;
 var size=document.containerForm.slct.options[document.forms[0].slct.options.selectedIndex].value;
 var pf=document.containerForm.slct_pf.options[document.forms[0].slct_pf.options.selectedIndex].value;
 if(pf==0)
   alert("Player plays first.");
 if(pf==1)
 {
   alert("Computer plays first.");
   meFirst=true;
 }
 if(pf=="none")
   alert("Please select who plays first!");
 if(size=="none")
   alert("Please select a Board size!");
 if((size=="other")&&(pf!="none"))
 {
   puts="<form name="form2">Enter size (eg 7):  <input type="text" name="ip" class="ip"> <input type="button" onClick="resolveMove(document.form2.ip.value)" value="Play!" class="btn"></form>";
   document.getElementById("container").innerHTML=puts;
 }
 if((size!="none")&&(size!="other")&&(pf!="none"))
   resolveMove(size);

} function resolveMove(size) {

 genBox(size,"container");
 if(meFirst)
   setTimeout("playFirst(""+size+"")",300);

} </script>

<form name="containerForm"><tbody></tbody>
<select name="slct"><option value="none" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">Select Board Size</option><option value="3" style="background: rgb(238, 238, 238) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">3 x 3</option><option value="4" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">4 x 4</option><option value="5" style="background: rgb(238, 238, 238) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">5 x 5</option><option value="other" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">Other Size</option></select><select name="slct_pf"><option value="none" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">Who plays first ?</option><option value="0" style="background: rgb(238, 238, 238) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">Player</option><option value="1" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">Computer</option></select><input class="btn" onclick="javascript:doGen()" value="Play!" type="button">
</form>


<tbody></tbody>
CopyRight 2002 Premshree Pillai. <a href="http://pub.alxnet.ru/guestbook?id=2395118" class="link">Sign my Guestbook</a> | <a href="http://www.qiksearch.ru/javascripts.htm" class="link">More JavaScripts</a>

</td></tr></tbody></table>

<tbody></tbody>
<tbody></tbody>

</body></html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/tictactoe.zip">tictactoe.zip( 18 k)</a>


Type Tutor

   <source lang="html4strict">

<html><head><title>jsTypingTutor</title>

<script language="JavaScript"> /*

  1. -----------------------------------------------------------------------------
  2. Name: jsTypingTutor
  3. Purpose: To help build typing speed in users
  4. and in developers.
  5. Author: Jason Don Stracner
  6. Created: 2001/10/06
  7. RCS-ID: $Id: jsTypingTutor_lib.js $
  8. Copyright: (c) Little Rock Technology Consulting
  9. Licence: GPL
  10. -----------------------------------------------------------------------------

jsTypingTutor - Source Code Documentation This file is the JavaScript code for jsTypingTutor. This project is intended to help users develop faster typing by simply re-typing text. The sample text files that are included are mainly computer code. Computer code is thought to make fuller use of the keyboard. It is a simple matter to add your own text to the HTML file and have any text displayed.

  • /

var objTimer=null; var rStartTime=0; var rSecondsPassed_=0; var rPauseStart_=0; var iStrLen_=0; var sStatMsg=""; /**

 * Sets text in txtStats_ on the HTML page on a timed interval.
 *
 *
 **/

function timer() {

 var dtNow_ = new Date();
 rSecondsPassed_ = dtNow_.getTime();
 rSecondsPassed_ = rSecondsPassed_ / 1000;
 rSecondsPassed_ = Math.round(rSecondsPassed_ - rStartTime);
 iStrLen_ = document.frmTyping_.txtTop_.value.length;
 iStrLen_ = iStrLen_ + document.frmTyping_.txtTypeHere_.value.length;
 sStatMsg="Characters: " + iStrLen_;
 sStatMsg += "  Seconds Passed:" + rSecondsPassed_;
 sStatMsg += "  Word per minute:" + Math.round((iStrLen_ / rSecondsPassed_)/ (6 / 60));
 document.frmTyping_.txtStats_.value=sStatMsg;

} /**

 * Called by button in HTML to start running the
 * "timer" function on a timed interval.
 *
 **/

function startTimer() {

 rStartTime = parseInt((new Date).getTime()/1000);
 rSecondsPassed_=0;
 endTimer();
 objTimer = setInterval("timer();",1000);

} /**

 * Called by button in HTML to pause the running 
 * of the "timer" function on a timed interval.
 *
 **/

function pauseTimer() {

 rPauseStart_ = parseInt((new Date).getTime()/1000);
 if (objTimer != null) {
   clearInterval(objTimer);
   objTimer = null;
 }

} /**

 * Called by button in HTML to resume the running 
 * of the "timer" function on a timed interval.
 *
 **/

function resumeTimer() {

 rStartTime=rStartTime+(parseInt((new Date).getTime()/1000)-rPauseStart_);
 if (objTimer != null) {
   clearInterval(objTimer);
   objTimer = null;
 }
 objTimer = setInterval("timer();",1000);

} /**

 * Called by button in HTML to stop running the
 * "timer" function on a timed interval.
 *
 **/

function endTimer() {

 rSecondsPassed_ = 0;
 if (objTimer != null) {
   clearInterval(objTimer);
   objTimer = null;
 }

} /**

 * Checks the content of the textbox "txtTypeHere_"
 * and eleminates any incorrect characters.
 *
 **/

function validateTyping(e) {

 var isNN = (navigator.appName.indexOf("Netscape")!=-1);
 if (isNN) {
   sChar = String.fromCharCode(e.which);
 } else {
   sChar = String.fromCharCode(event.keyCode);
 }
 var iTypedLength =  document.frmTyping_.txtTypeHere_.value.length;
 var sInitialValue = document.frmTyping_.txtBottom_.value.substring(0,iTypedLength);
 var sTestChunk =    document.frmTyping_.txtTypeHere_.value.substring(0,iTypedLength) + sChar;
 var sCorrectChunk = document.frmTyping_.txtBottom_.value.substring(0,iTypedLength+1);
 
 if (sTestChunk != sCorrectChunk) {
   document.frmTyping_.txtTypeHere_.value=sInitialValue;
 } else {
   document.frmTyping_.txtTypeHere_.value=sCorrectChunk;
 }
 if (escape(document.frmTyping_.txtBottom_.value.charAt(iTypedLength))=="%0D") {
   document.frmTyping_.txtTop_.value+= "\n" +
   document.frmTyping_.txtBottom_.value.substring(0,iTypedLength);
   document.frmTyping_.txtBottom_.value=
   document.frmTyping_.txtBottom_.value.substring(iTypedLength+2,document.frmTyping_.txtBottom_.value.length);
   document.frmTyping_.txtTypeHere_.value="";
 }
 
 //There should never be a return character at the end.
 if (escape(document.frmTyping_.txtTypeHere_.value.charAt(iTypedLength-1))=="%0A") {
   // Remove return character.
   document.frmTyping_.txtTypeHere_.value=
      document.frmTyping_.txtTypeHere_.value.substring(0,iTypedLength-2);
 }

} </script> </head> <body text="#0000ff"> <center>jsTypingTutor</center>




<center> <form name="frmTyping_">Typing statistics:
<textarea name="txtStats_" rows="1" cols="80"></textarea>
<input onclick="startTimer()" value="Start" name="cmdStartTimer_" type="button"> <input onclick="pauseTimer()" value="Pause" name="cmdPauseTimer_" type="button"> <input onclick="resumeTimer()" value="Resume" name="cmdResumeTimer_" type="button"> <input onclick="endTimer()" value="Stop" name="cmdEndTimer_" type="button">
<textarea name="txtTop_" rows="8" cols="80"></textarea>
Type text into this area:
<textarea name="txtTypeHere_" rows="1" cols="80" onkeypress="validateTyping(event);return false;"></textarea> <textarea name="txtBottom_" rows="8" cols="80">Instructions: Paste some text into this area then press the "Start button". </textarea>
</form> </center> </body></html>

      </source>
   
  


Word search game

   <source lang="html4strict">


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=UTF-8;" /> <style type="text/css"> html,body {

 height:95%;
 margin:0px;
 font-family:Arial;
 cursor: crosshair;

} input {

 padding:2px;
 border:1px solid;
 background:#CCC;
 cursor:crosshair;

} textarea {

 padding:2px;
 border:1px solid;
 background:#CCC;
 cursor:crosshair;

} select {

 padding:2px;
 border:1px solid;
 background:#CCC;
 cursor:crosshair;

} a {

 text-decoration:none;
 color:black;

} tr,td {

 border:1px solid black;
 padding:5px;

} .tablist {

 border:1px solid black;
 border-bottom:0px;
 margin-left:5px;
 padding-left:5px;
 padding-right:5px;

} .tabcontent {

 border:1px solid black;
 padding:5px;
 height:560px;
 background:#DDD;

} .inputTitle {

 font-weight:bold;
 font-size:12px;

} .info {

 font-size:12px;

} li {

 font-size:12px;
 font-weight:normal;
 margin-bottom:5px;

} </style> <script type="text/javascript" src="wordsearch.js"></script> </head> <body onload="eventHandle();showStart();"> <noscript>You must have Javascript enabled to use this script.</noscript> <script type="text/javascript"> function changebgcolor(color) {

 document.bgColor = color;

} </script>

<script type="text/javascript">document.write(title);</script>

</body> </html>

      </source>
   
  

<A href="http://www.wbex.ru/Code/JavaScriptDownload/jswordsearch_0.4.zip">jswordsearch_0.4.zip( 25 k)</a>


Yasminuroban (by Joan Alba Maldonado)

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

   <head>
       <title>Yasminuroban © (by Joan Alba Maldonado)</title>
       
       <script language="JavaScript1.2" type="text/javascript">
           
       </script>
   </head>
   <body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="javascript:recoger_mapa_url();" onKeyDown="javascript:pulsar_tecla(event, "onkeypress");" onKeyPress="javascript:pulsar_tecla(event, "onkeydown");">
       
           <a href="javascript:deshacer_accion();" title="Undo movement (U)"><img src="img/deshacer.gif" title="Undo movement (U)" alt="Undo movement" border="0" hspace="0" vspace="0" width="40" height="40"></a>
           <a href="javascript:rehacer_accion();" title="Redo movement (Y)"><img src="img/rehacer.gif" title="Redo movement (Y)" alt="Redo movement" border="0" hspace="0" vspace="0" width="40" height="40"></a>
           <a href="javascript:reiniciar_nivel();" title="Restart level (R)"><img src="img/reiniciar.gif" title="Restart level (R)" alt="Restart level" border="0" hspace="0" vspace="0" width="40" height="40"></a>
              <img src="img/editor.gif" title="Level editor" alt="Level editor" border="0" hspace="0" vspace="0" width="40" height="40" style="cursor: pointer; cursor: hand;" onClick="javascript:if (confirm("Press ok if you want to load level editor (actual game will be end)")) { window.location.href=url_editor; }"></a>
                   Loading...
               
© Yasminuroban by Joan Alba Maldonado




               Loading...


           © Yasminuroban 0.68a by Joan Alba Maldonado (<a href="mailto:granvino@granvino.ru;">granvino@granvino.ru</a>)  (DHTML 100%)
           
  - Prohibited to publish, reproduce or modify without maintain original author"s name.
  * Keyboard arrows to move and push, "U" to undo movement, "Y" to redo movement, and "R" to restart level. Under Opera, leave the mouse cursor over game zone.
  Dedicated to Yasmina Llaveria del Castillo </body>

</html>

      </source>
   
  
<A href="http://www.wbex.ru/Code/JavaScriptDownload/yasminuroban_english.zip">yasminuroban_english.zip( 49 k)</a>