Foros del Web » Programando para Internet » Javascript »

ajedrez

Estas en el tema de ajedrez en el foro de Javascript en Foros del Web. Me estoy creando un tablero de ajedrez en javascript con el siguiente codigo: <html> <head> <script> function tablero(){ // set the inital background color var ...
  #1 (permalink)  
Antiguo 15/04/2009, 02:17
 
Fecha de Ingreso: marzo-2009
Mensajes: 19
Antigüedad: 15 años, 1 mes
Puntos: 1
ajedrez

Me estoy creando un tablero de ajedrez en javascript con el siguiente codigo:

<html>
<head>
<script>
function tablero(){
// set the inital background color
var squareCol="white";

// create an array to hold the alphabetical part of the square name in algebraic notation
var arr_squareLetter = new Array("a","b","c","d","e","f","g","h");

// create the table to hold the board
document.write("<table width='340' height='340' border='2'>");

// for each row on the board
for (rows=0;rows<8;rows++)
{
// start the table row
document.write("<tr align='center'>");

// for each colum
for (columns=0;columns<8;columns++)
{
// create the square.
// Putting a blank image in there from our globally defined graphics directory
// with an ID equal to the algebraic name for the square.
document.write("<td width='40' height='40' bgcolor='" + squareCol + "' align='center'>");
document.write("<img name='" + arr_squareLetter[columns] + "" + (8-rows) + "' src='" + url_graphicbin + "spacer.gif'>");
document.write("</td>");

// swap the colours
if (squareCol=="#CCCCCC")
{
squareCol="white";
}
else
{
squareCol="#CCCCCC";
}
}
// end the table row
document.write("</tr>"); }
</script>

</head>

<body onload="tablero();">
</body>
</html>


¿Como puedo hacer para que al abrir el fichero html me muestre el tablero en el navegador?


Un saludo,
  #2 (permalink)  
Antiguo 15/04/2009, 03:19
 
Fecha de Ingreso: enero-2009
Mensajes: 212
Antigüedad: 15 años, 4 meses
Puntos: 4
Respuesta: ajedrez

Aqui tienes la info que busca, supongo que sacastes los datos de aqui, pero por si acaso :

http://www.webreference.com/programm...ipt/javachess/
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:43.