MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
February
Sun Mon Tue Wed Thu Fri Sat
     
24
     
2012
Months
Feb


Fri, Feb 24, 2012 4:10 pm

JavaScript Language Versus Type Attribute

After updating an old webpage, I validated the HTML on the page with the W3C Markup Validation Service. One of the errors reported for the page was the following one:

Error image - white x in red circle Line 19, Column 30: required attribute "TYPE" not specified

<script language="JavaScript">

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type= "text/javascript" for <script>.

In the head section of the HTML code, I had the following line:

<script language="JavaScript">

I didn't realize that the language attribute has been deprecated in favor of the type attribute. According to a posting I found at HTML Script tag: type or language?

The language attribute has been deprecated. Both will work in pretty much all browsers, but the first better adheres to modern standards.

The javascript code on the page was working as expected when I viewed the page with a browser, but I changed the line to the one below:

<script type="text/javascript">

[/network/web/browser/javascript] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo