[thelist] Confused about what HTML Validation is telling me

MRC webmaster at equilon-mrc.com
Thu Feb 7 17:08:00 CST 2002


Bob,

> So does this mean that I can't truley become complient with this standard?
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

    The "language" attribute is deprecated under HTML 4.01 [1], meaning that
it *is* valid HTML when using a loose or transitional dtd. So, as long as
you are using a transitional dtd (such as specified in the doctype
declaration above), in either HTML 4.x or XHTML 1.0, it is perfectly valid
to use the language attribute within your script element. If you want to
move to a strict dtd, however, then you must use only the "type" attribute
instead.
    Using both "language" and "type" within the same script element is
really just a compromise, but generally using "type" alone will work because
even legacy browsers that don't understand the attribute will treat the
script element as though it were simply <script>, applying the default
scripting language, which is essentially always Javascript 1.0.
    You only run into a problem if you *need* to specify a language version
other than this default, in which case you will need to use the "language"
attribute *without* the "type" attribute, thus requiring a transitional dtd.

James Aylard

1. http://www.w3.org/TR/html401/interact/scripts.html#adef-language




More information about the thelist mailing list