HTML Help
Please
Search
for the answer to your question before asking it! Thanks.
creating a chess-board...help!
Post a Reply to this Topic
Ask a New Question
Click here to go to the original topic
HTML Help Forum Index
->
Javascript
View previous topic
::
View next topic
Author
Message
arashb86
Joined: 17 Sep 2009
Posts: 2
Posted: Thu Sep 17, 2009 11:21 am
creating a chess-board...help!
hi all...
im going to create a html chess board with java and i write this program...but it didnt work!...y? can anybody help me,plz?
<html>
<head>
<style>
.t
{
cellpadding:0px
cellspacing:0px
}
.b
{
width:50px;
height:50px;
background-color:black
}
.w
{
width:50px;
height:50px;
background-color:white
}
</style>
</head>
<body>
<script type="text/javascript">
var x = 0;
y = x % 2;
document.write('<table class="t">');
for (j = 1; j <= 5; j++)
{
document.write('<tr>');
for (i = 1; i <= 5; i++)
{
if (y = 0)
{
document.write('<td class="b"></td>');
x++;
}
else
{
document.write('<td class="w"></td>');
x++;
}
}
document.write('</tr>');
}
document.write('</table>');
</script>
</body>
</html>
nikki
Joined: 24 Nov 2008
Posts: 132
Posted: Thu Sep 17, 2009 12:38 pm
"==" is used to check the condition.
Code: <html>
<head>
<style>
.t
{
cellpadding:0px ;
cellspacing:0px ;
background-color: gray;
}
.b
{
width:50px;
height:50px;
background-color:black
}
.w
{
width:50px;
height:50px;
background-color:white
}
</style>
</head>
<body >
<script type="text/javascript">
var x = 0;
document.write('<table class="t">');
for (j = 1; j <= 5; j++)
{
document.write('<tr>');
for (i = 1; i <= 5; i++)
{ var y = x % 2;
if (y == 0)
{
document.write('<td class="b"> </td>');
x++;
}
else
{
document.write('<td class="w"> </td>');
x++;
}
}
document.write('</tr>');
}
document.write('</table>');
</script>
</body>
</html>
arashb86
Joined: 17 Sep 2009
Posts: 2
Posted: Fri Sep 18, 2009 11:10 am
tanx alot!
DARFUR
Get a
Stop the Genocide
poster at
SaveDarfur.org
.
Also see
Eyes on Darfur
.
HOSTING / DESIGN
$1.99 Domain Registration
Cheap Web Hosting
Website Templates
MAKE MONEY
Sell Domain Names
Sell Website Templates
Your Ad Here
HTML Help Forum Index
->
Javascript
Page
1
of
1
Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group