Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q12 How can I get script embedded in a table to work?

You are here: irt.org | FAQ | JavaScript | Table | Q12 [ previous next ]

The following HTML will not work on all browsers:

<table border=1>
  <tr>
    <td>
      <script language="JavaScript"><!--
        document.write("JavaScript Text which may or may not be output");
      //--></script>
    </td>
    <td>
      <script language="JavaScript"><!--
        document.write("JavaScript Text which may or may not be output");
      //--></script>
    </td>
  </tr>
</table>

Whereas the following code will work on all:

<script language="JavaScript"><!--
document.write("<table border=1>");
  document.write("<tr>");
    document.write("<td>");
        document.write("JavaScript Text which may or may not be output");
    document.write("<\/td>");
    document.write("<td>");
        document.write("JavaScript Text which may or may not be output");
    document.write("<\/td>");
  document.write("<\/tr>");
document.write("<\/table>");
//--></script>

©2018 Martin Webb