I know that I have already posted this elsewhere, but I was hoping that this would get a few more people looking at it.
My teacher has given us an assignment and wants us to finish filling out his coding. I originally had figured out how to make a checkerboard with different coding but he didn't accept it. So that you can help get me going in the write direction I'm going to cut and paste the assignment and then my failed attempt at solving it. I'm not going to post what I actually got to work, but was unacceptable to the teacher as it will not help.
Any advise would be appreciated. Thanks for looking at it.
His code:
CODE
1 <?xml version = "1.0" encoding = "utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5
<!-- Exercise 7.25 Solution -->
6 <html xmlns = "http://www.w3.org/1999/xhtml">
7 <head>
8 <title>Solution 7.25</title>
9 <script type = "text/javascript">
10 <!--
11 var side = 8;
12 var row;
13
14 document.writeln( );
15
16 while( )
17 {
18 row = 8;
19
20 if( )
21 document.write( );
22
23 while( )
24 {
25
26 document.write( );
27 row -= 1;
28 } // end while
29
30 document.writeln( );
31 side -= 1;
32 } // end while
33
34 document.writeln( );
35 // -->
36 </script>
37 </head>
38 <body>
39 <p>Click Refresh (or Reload) to run this script again.</p>
40 </body>
41 </html>
My revised code:
CODE
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Solution 7.25</title>
<script type = "text/javascript">
<!--
var side = 8;
var row;
document.writeln( "<pre>" );
while( side % 2 != 0 )
{
row = 8;
if( row >= 1 )
document.write( " " );
while( side >= 1 )
{
document.write( "* " );
row -= 1;
} // end while
document.writeln( );
side -= 1;
} // end while
document.writeln( "</pre>" );
// -->
</script>
</head>