Simple Chessboard Program in Javascript

Thursday 19 November 2015

<html>
<head>
</head>
<body>
<script type="text/javascript">
document.write('<table border="1">');
for(var i=0;i<=7;i++)
{
document.write('<tr>');
for(var j=0; j<=7; j++)
{
var k=i+j;
if(k%2==0)
{
document.write("<td style='width:50px;height:50px;background-color:black;'></td>");
}
else
{
document.write("<td style='width:50px;height:50px;background-color:white;'></td>");
}
}
document.write('</tr>');
}
document.write('</table>');
</script>
</body>
</html>

No comments:

Post a Comment

 

Blogger news

Blogroll

Most Reading