W3C home > Mailing lists > Public > www-validator@w3.org > June 2000

Re: Valid positioning of script elements

From: Bertilo Wennergren <bertilow@hem.passagen.se>
Date: Mon, 5 Jun 2000 23:59:09 +0200
Message-ID: <005501bfcf39$5aa96680$fbe05dd5@chello.se>
To: <pdf@bizfon.com>, <www-validator@w3.org>
Andrew Clover:

> The following code is invalid, according to the w3 validator.  But I would argue
> that it should not be.  Can someone offer an explanation as to why it should be
> invalid?

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>      <title>Test</title>
> </head>
> 
> <body>
> 
> <table>
>      <tr>
>           <td>1,1</td></tr>
>      <script language="Javascript" type="text/javascript">
>      var str = "<tr><td>2,1<\/td><\/tr>"
>      document.write(str);
>      </script>
> </table>
> 
> </body>
> </html>

Try this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
     <title>Test</title>
</head>

<body>

<script type="text/javascript">
   document.write('<table>');   
   document.write('<tr>');
   document.write('<td>1,1<\/td><\/tr>');
   var str = "<tr><td>2,1<\/td><\/tr>";
   document.write(str);
   document.write('<\/table>');
</script>

</body>
</html>

#####################################################################
                         Bertilo Wennergren
                 <http://purl.oclc.org/net/bertilo>
                     <bertilow@hem.passagen.se>
#####################################################################
Received on Monday, 5 June 2000 17:55:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:13:54 GMT