Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Table | Q12 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.