Could someone tell me why my script in a new document in which I only copy the script does work though when I put it in an html document?
Thanks in advance.
The code is this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link type="text/css" rel="stylesheet" href="estilos.css" />
</head>
<body>
<p>TABLERO DE DIBUJO EN JAVASCRIPT</p>
<table width="500" border="1" id="paleta" summary="Tabla de selección de colores">
<caption>Haga click en un color para comenzar a pintar</caption>
<tr><td class="color1 seleccionado"></td><td class="color2"></td><td class="color3"></td><td class="color4"></td><td class="color5"></td><td class="color6"></td></tr>
<tr><td colspan="6" id="pincel">Estado del pincel</td></tr>
</table>
<p></p>
<div id="zonadibujo">
<table id="tablerodibujo"></table>
<script type="text/javascript">
var elementoTable = document.createElement("table");
for(f=0; f<30; f++){
var elementoTR = document.createElement("tr");
for(c=0; c<30; c++){
var elementoTD = document.createElement("td");
elementoTR.appendChild(elementoTD);
}
elementoTable.appendChild(elementoTR);
}
document.getElementById("tablerodibujo").appendChild(elementoTable);
</script>
</div>
</body>
</html>