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,