By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,445 Members | 1,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,445 IT Pros & Developers. It's quick & easy.

problem validating

mickey0
100+
P: 142
hello, validating this file on w3c I have many error:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7.  
  8. <script type="text/javascript" src="java.js"></script>
  9.  
  10. <script type="text/javascript">
  11. function myFunc () {
  12.        for (var i=0;i<100;i++) {
  13.             var table = document.getElementById("intro");  
  14.             var row = document.createElement("tr");
  15.             var cell = document.createElement("td");
  16.             var link = document.createElement("a");    
  17.             link.setAttribute("href", "http://www.google.com");
  18.             var linkText = document.createTextNode(" HII ");     
  19.             link.appendChild(linkText);
  20.             cell.appendChild(link);
  21.             row.appendChild(cell);
  22.             table.appendChild(row);        
  23.     }
  24. }   
  25. </script>
  26.  </head>
  27.  <body onload="myFunc()">
  28.     <table style="width: 100%" border="5" >
  29.        <tr><td> GETTS</td> </tr>
  30.         <tbody id="intro"><tr><td></td></tr> </tbody>
  31.     </table>
  32. </body>
  33. </html>
  34.  
Could anyone help me? (
character "<" is the first character of a delimiter but occurred as data.
end tag for "head" which is not finished.
.....
and others...)
EDIT: is docType ok?
Jan 31 '08 #1
Share this Question
Share on Google+
1 Reply


harshmaul
Expert 100+
P: 490
a few things missing.

Heres the full code...

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head>
  6. <title>hello world</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  8.  
  9. <script type="text/javascript" src="java.js"></script>
  10.  
  11. <script type="text/javascript">
  12. <!--
  13. function myFunc() {
  14.        for (var i=0;i < 100;i++) {
  15.             var table = document.getElementById("intro");  
  16.             var row = document.createElement("tr");
  17.             var cell = document.createElement("td");
  18.             var link = document.createElement("a");    
  19.             link.setAttribute("href", "http://www.google.com");
  20.             var linkText = document.createTextNode(" HII ");     
  21.             link.appendChild(linkText);
  22.             cell.appendChild(link);
  23.             row.appendChild(cell);
  24.             table.appendChild(row);        
  25.     }
  26. }
  27. -->
  28. </script>
  29.  </head>
  30.  <body onload="myFunc()">
  31.     <table style="width: 100%" border="5" >
  32.        <thead><tr><td> GETTS</td> </tr></thead>
  33.         <tbody id="intro"><tr><td></td></tr> </tbody>
  34.     </table>
  35. </body>
  36. </html>
firstly you need a title in the head tag
you need to put the tables head bit in a thead tag
finally use html comments around you javascript.

hope that helped
Jan 31 '08 #2

Post your reply

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