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

Valid positioning of script elements

From: Clover Andrew <aclover@1VALUE.com>
Date: Mon, 5 Jun 2000 20:44:00 +0200
Message-ID: <5F78AA062F6AD311A59000508B4AAF6D092B4E@pcs02>
To: "'www-html@w3.org'" <www-html@w3.org>
I note from the HTML 4.01 DTD and from coming a cropper on the
validator that one may only insert <script>s at block-level,
inline, or in <head>. It is invalid for a script to live in
structural markup such as <table>, <tr>, <dl> and so on.

Is there any particular rationale behind this definition, or is
it simply arbitrary? (It differs from every browser's
implementation of <script>, though of course that on its own
doesn't mean anything.) Is there any chance of a change in the

It would be quite useful to me to be able to, for example,
document.write(some extra table rows), to produce content
that only appears when JavaScript is enabled (with different,
backup behaviour where scripting is not supported, natch).
The alternative is to write <tr> and <td> elements with
block-level <script>s inside them, leaving empty rows
when scripting is unavailable. This does not appeal to
me aesthetically. :-)

Andrew Clover
Technical Support
Received on Monday, 5 June 2000 14:47:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:54 UTC