469,356 Members | 2,254 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Outputting a Table in javascript

I am new to this forum and to javascript I have something due for class tomorrow but I can't figure out what is wrong with this code that it won't output a table to the screen. I don't understand how to embed the html inside of the document.write command. Any help is much appreciated.

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang = "en" dir="ltr">
<head>
<link rel="stylesheet" href="js_styles.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Highest Waterfalls</title>
<script type="text/javascript">
/* <![CDATA[ */
/*
This document prints the names, locations, and heights of the 10 highest waterfalls in the world.
*/
document.write("<h1>Don's Jungle Tours</h1>");
/* ]]> */
</script>
</head>

<body>
<h1>Highest Waterfalls</h1>
<p>The names, locations, and heights of the 10 highest waterfalls in the world are as follows:</p>
<table> <COLGROUP span="3" width="20"/>
<tr><th>Name</th><th>Location</th><th>Height</th></tr>
<script type="text/javascript">
/* <![CDATA[ */
document.write("<tr><th>Name</th><th>Location</th><th>Height (in meters)</th></tr>");
document.write("<tr><td>Angel (upper fall)</td><td>Venezuela</td><td>807</td></tr>";
document.write("<tr><td>Itatinga</td><td>Brazil</td><td>628</td></tr>");
document.write("<tr><td>Cuquenan</td><td>Guyana/Venezuela</td><td>610</td></tr>");
document.write("<tr><td>Ormeli</td><td>Norway</td><td>563</td></tr>");
document.write("<tr><td>Tysse</td><td>Norway</td><td>533</td></tr>");
document.write("<tr><td>Pilao</td><td>Brazil</td><td>524</td></tr>");
document.write("<tr><td>Ribbon</td><td>USA</td><td>491</td></tr>");
document.write("<tr><td>Vestre Mardola</td><td>Norway</td><td>468</td></tr>");
document.write("<tr><td>Kaieteur</td><td>Guyana</td><td>457</td></tr>");
document.write("<tr><td>Cleve-Garth</td><td>New Zealand</td><td>450</td></tr>");
document.write("</table>");
/* ]]> */
</script>
</body>
</html>[/HTML]
Aug 26 '08 #1
1 1707
gits
5,390 Expert Mod 4TB
check all your document.write() statements for correct syntax ... have a look at line 25 for example ... ;)

kind regards
Aug 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Craig Thomson | last post: by
15 posts views Thread by Jarrod Morrison | last post: by
3 posts views Thread by BakedBean | last post: by
2 posts views Thread by andy.z | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.