title: Syntax Error on Drawing Script (JavaScript)
body: <p>I'm writing a program for my class (javascript) that simply draws lines on a canvas. And uses the alt key to draw white and give the appearance of it being 'Erased'. I finished the code, but i'm getting a syntax error and can't see what i'm doing wrong. Can you guys please help?</p>
  
  <pre><code>&lt;?xml version = "1.0" encoding = "utf-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Simple Drawing Program&lt;/title&gt;
  
   (Assignment 7a)&lt;br /&gt;&lt;hr /&gt;
  &lt;style type = "text/css"&gt; 
      #canvas { width: 400px; 
                border: 1px solid #999999; 
                border-collapse: collapse} 
      td      { width: 4px; 
                height: 4px } 
      th.key  { font-family: arial, helvetica, sans-serif;
                font-size: 12px; 
                border-bottom: 1px solid #999999 } 
    &lt;/style&gt; 
    &lt;script type = "text/javascript"&gt;
      &lt;!-- 
      // initialization inserts cells into the table 
      function createCanvas () 
        var side = 100; 
  
        var tbody = document.getElementById ("tablebody"); 
  
        for (var i = 0; i &lt; side; i++) 
        { 
          var row = document.createElement ("tr"); 
  
          for (var j = 0; j &lt; side; j++) 
          { 
  
            var cell = document.createElement ("td"); 
  
            cell.onmousemove = processMouseMove;
            row.appendChild (cell);
          }
          tbody.appendChild (row);
        }
      }
  
      // draws when mouse is moved by turning cells red or blue
      function processMouseMove (event) { 
        // get IE event
        if (! event) {event = window.event;} 
        // turn cell blue if Ctrl key is pressed
        if (event.ctrlKey) {this.style.backgroundColor = "blue";} 
        // turn cell red if Shiftkey is pressed
        if (event.shiftKey) {this.style.backgroundColor = "red";}
        // turn cell white if Altkey is pressed
        if (event.altKey) {this.style.backgroundColor = "white";}
      }
      // --&gt;
    &lt;/script&gt; 
  &lt;/head&gt; &lt;body onload = "createCanvas()"&gt; 
    &lt;table id ="canvas" class="canvas"&gt;&lt;tbody id="tablebody"&gt;
        &lt;tr&gt;&lt;th class="key" colspan="1OO"&gt;Hold &lt;tt&gt;ctrl&lt;/tt&gt;
            to draw blue. Hold &lt;tt&gt;shift&lt;/tt&gt; to draw red. Hold &lt;tt&gt;alt&lt;/tt&gt;to erase lines&lt;/th&gt;&lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt; 
  &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  
  <p>the error is given on the line 'var side = 100;'</p>