Click here to Skip to main content
13,000,022 members (50,167 online)
Rate this:
Please Sign up or sign in to vote.
See more:
My instructor wants for us to use the documentwrite.ln for a very simple html table with 3 columes and 2 rows. I can create the table fine with the html but can not get the javascript to work. He did not give us any good examples for the use of document.writeln on a table, just regular text. Here is what I have been trying, I have been looking things up online trying to figure this out.

<script type"text/javascript">
<table cellspacing="5" border="2">
document.write (" <tr><td>");
document.write (" <th>Course");
document.write (" <th>Name");
document.write (" <th>Focus");
document.write (" </tr>");
document.write (" <tr>");
document.write (" <td>CST 214</td>");
document.write (" <td>JavaScript Programming</td>");
document.write (" <td>Client-Side Web Programming</td>");
document.write (" </tr>");
document.write (" <tr>");
document.write (" <td>CST 217</td>");
document.write (" <td>Web Server Programming</td>");
document.write (" <td>Server-Side Web Programming</td>");
document.writeln (" </tr>");
// -->
Posted 11-Sep-10 12:34pm
TheyCallMeMrJames 12-Sep-10 0:35am
+5 because you stated clearly your problem, showed what you tried. Use this as a reference:

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You want to move your table element outside of your script tags:

<table cellspacing="5" border="2">
<script type"text/javascript">
// -->

Good luck with your assignment.

Doris Christian 12-Sep-10 6:37am
Thanks a bunch, that worked!
TheyCallMeMrJames 12-Sep-10 12:37pm
No worries...fix that first tr/td before your headers and you should be off to the races. Cheers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 12 Sep 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100