title: How to use CSS in html table inside javascript
body: <p>This a sample code to show how i am using HTML tags inside of the javascript. I want to add CSS style to the table also, but its not working inside of the javascript code. Could anyone please suggest how to add CSS style to my html table inside of the javascript.</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;style type="text/css"&gt;
              table.imagetable 
              {
                  font-family: verdana,arial,sans-serif;
                  font-size:11px;
                  color:#333333;
                  border-width: 1px;
                  border-color: #999999;
                  border-collapse: collapse;
              }
              table.imagetable th 
              {
                  background:#b5cfd2 url('cell-blue.jpg');
                  border-width: 1px;
                  padding: 8px;
                  border-style: solid;
                  border-color: #999999;
              }
              table.imagetable td 
              {
                  background:#dcddc0 url('cell-grey.jpg');
                  border-width: 1px;
                  padding: 8px;
                  border-style: solid;
                  border-color: #999999;
              }
          &lt;/style&gt;
  &lt;script language="JavaScript" &gt;
              function getSubmit()
              {
  
                  var strHtml ="";
                  strHtml += "&lt;table class = 'imagetable' &gt;";
                  strHtml += "&lt;tr&gt;";
                  strHtml += "&lt;th&gt;S No&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Roll Number&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Name&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Maths&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Physics&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Chemistry&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Total&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Percentage&lt;/th&gt;";
                  strHtml += "&lt;th&gt;Division&lt;/th&gt;"
                  strHtml += "&lt;/tr&gt;"
                  strHtml += "&lt;/table&gt;";
                  document.write(strHtml);
              }
          &lt;/script&gt;
          &lt;div align="center" style="border-bottom-color:#330000"&gt;
              &lt;table border="1" bordercolor="#000000" class= "imagetable"&gt;
                  &lt;th&gt;S No&lt;/th&gt;
                  &lt;tr align="center"&gt;
                      &lt;td&gt;&lt;input name="button" type="button" onClick="getSubmit()" value="submit"/&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>