title: Issues with JavaScript and XHTML Strict Code
body: <p>I have an issue with meeting XHTML Strict requirements for a class assignment. The class assignment says to use java script to generate a table, but only the array can be use in an external javascript file. This has lead to some issues when trying to meet XHTML Scrict requirements. The 'rule' i break is as follows:</p>
  
  <blockquote>
    <p>Line 147, Column 38: document type does not allow element "script" here</p>
    
    <p>script type="text/javascript"</p>
    
    <p>The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).</p>
    
    <p>One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).</p>
  </blockquote>
  
  <p>The line that is generating this error is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      &lt;!--
      for(var i=0; i&lt;5;i++){
          document.write('&lt;tr&gt;&lt;td class="classes"&gt;');
          document.write(classArray[i]);
          document.write('&lt;/td&gt;&lt;/tr&gt;');
      }
      --&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>The issue is this code is in the 'body' tags. I'm not sure how i can replicate this code to place it in the head while generating a table in the spot I want on the page. Any help would be much appreciated. I really don't know   much about XHTML Strict or Javascript, this is just part of a 3 week module for class, and all my experience is from lecture/reading.</p>
  
  <p>Full Code, Suspect is toward bottom:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" &gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
          &lt;title&gt;Career Goals&lt;/title&gt;
  
          &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
          &lt;style type="text/css"&gt;
              body
                  {
                      background-image:url('./images/marbleBG.jpg');
                      background-repeat:no-repeat;
                      background-position:right top;
                      background-size: 100% , 100%;
                      margin-top:5%;
                      margin-bottom:5%;
                      font-family: sarif;
                      text-align: center;
                      font-size: 18px;
                  }
              table.main
                  {
                      margin-left: auto;
                      margin-right:auto;
                      height: auto;
                      width: 65%;
                      border: 0px solid black;
                  }
              table.classes
                  {
                      margin-left: 15%;
                      margin-right:auto;
                      height: 100%;
                      width: auto;
                      text-align : left;
                      border-collapse: collapse;
  
                  }
              td.classes
                  {
                      text-indent : 25px;
                      border: 1px solid;
                      padding: .3em;
                  }
              th.classes
                  {
                      padding: .3em;
                      border: 1px solid;
                  }
              table.centered
                  {
                      margin-left: 15%;
                      margin-right: auto;
                      border: 0px solid black;
                  }
              h1.title
                  {
                      text-align: center;
                      padding-bottom:25px;
                  }
              p.left
                  {
                      text-align: left;
                      font-size: 16px;
                      text-indent: 25px;
                  }
  
              li
                  {
                      text-align: left;
                  }
          &lt;/style&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;script type="text/javascript" src="myarray.js" &gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="mycookie.js" &gt;&lt;/script&gt;
  
          &lt;table class="main"&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;h1 class="title"&gt; Career Goals &lt;/h1&gt;
  
                      &lt;p class="left"&gt;
                          My goals when I complete my computer science degree with Arizona State University will include 
                          joining a corporation where I can improve my technical skills and assist in the growth of said company. 
                          I would like to be a part of a team of programmers with common career interests where we can motivate each 
                          other to visibly show improvement as our careers progress.
                      &lt;/p&gt;
  
                      &lt;p class="left"&gt;
                          In my study with Arizona State University I have learned many popular programming languages. In my career I plan
                          on utilizing most, if not all, of the languages I know. The programing languages I know include:
                      &lt;/p&gt;
  
                      &lt;table class="centered"&gt;
                          &lt;tr&gt;
                              &lt;td&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;Java&lt;/li&gt;
                                      &lt;li&gt;C/C++&lt;/li&gt;
                                      &lt;li&gt;Scala&lt;/li&gt;
                                      &lt;li&gt;Java Scripting&lt;/li&gt;
                                      &lt;li&gt;PERL Scripting&lt;/li&gt;
                                      &lt;li&gt;Unix Scripting&lt;/li&gt;
                                      &lt;li&gt;HTML/XHTML&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
  
                      &lt;p class="left"&gt;
                          With Arizona State Univeristy I did not just learn programming languages, I learned industry practicies. In my career
                          I expect to utilize msot of these techniques, as well as learn new practicies to improve the quality of software I
                          assist in creating. The techniques taught by Arizona State University include:
                      &lt;/p&gt;
                      &lt;table class="centered"&gt;
                          &lt;tr&gt;
                              &lt;td&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;Extreme Programming&lt;/li&gt;
                                      &lt;li&gt;Paired Programming&lt;/li&gt;
                                      &lt;li&gt;Code Reviews&lt;/li&gt;
                                      &lt;li&gt;Refacotring Sessions&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
  
  
  
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;
  
                      &lt;p class="left"&gt; At Arizona State University I have taken many classes to progress 
                      in my computer science degree. Some of the classes that I have taken that may assist in my career goals are:
                      &lt;/p&gt;
  
                      &lt;table class="classes"&gt;
                          &lt;tr&gt;
                              &lt;th class="classes"&gt;
                                  &lt;b&gt;Classes Taken for Computer Science Major&lt;/b&gt;
                              &lt;/th&gt;
                          &lt;/tr&gt;
                              &lt;script type="text/javascript"&gt;
                                  &lt;!--
                                  for(var i=0; i&lt;5;i++){
                                      document.write('&lt;tr&gt;&lt;td class="classes"&gt;');
                                      document.write(classArray[i]);
                                      document.write('&lt;/td&gt;&lt;/tr&gt;');
  
                                  }
                                  --&gt;
                              &lt;/script&gt;
                      &lt;/table&gt;
  
                  &lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;p class="left"&gt;
                          More of my skills and goals can be found on my &lt;a href="resume.html"&gt;resume&lt;/a&gt;. If you feel my career goals would be a great addition
                          to your team you can contact me using my &lt;a href="contact.html"&gt;contact form&lt;/a&gt;.
                      &lt;/p&gt;
  
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
           &lt;p&gt;
              &lt;a href="http://validator.w3.org/check?uri=referer"&gt;&lt;img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /&gt;&lt;/a&gt;
          &lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>