type="text/javascript" missing?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

type="text/javascript" missing?

Post by Davidk »

Hi!

When I validate my template page: http://www.davidkarlsson.se/mall.shtml

in the W3 HTML-validitor, i get the following result:

Line 19, column 29: required attribute "TYPE" not specified.
<script language="JavaScript">


This is in reference to my menu which happens to end up on line 19 according to the following:

Code: Select all

<script language="JavaScript" src="/includes/milonic_src.js" type="text/javascript"></script>	
  19: <script language="JavaScript">
  20: if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/includes/mmenuns4.js><\/scr"+"ipt>");		
  21: else _d.write("<scr"+"ipt language=JavaScript src=/includes/mmenudom.js><\/scr"+"ipt>"); 
  22: </script>
  23: <script language="JavaScript" src="/includes/menu_data.js" type="text/javascript"></script>
Has the type="text/javascript" been left out on purpose in the menu call on this line, or is there a need for me to add it? And does it make a difference?

Thanks!

David
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: type="text/javascript" missing?

Post by kevin3442 »

Davidk wrote:...Has the type="text/javascript" been left out on purpose in the menu call on this line,
I'm only guessing here, but I'd say that it probably was left out on purpose because Andy deemed it unnecessary. His style tends toward an economy of characters, to produce faster-loading code, so he leaves out things that aren't necessary. Witness, for example, that when he does set the type attribute in the <script> tag, he often omits the double quotes around the value.
...or is there a need for me to add it?
No real need... it'll work fine without it. But HTML 4.0 validators will probably point it out to you.
...And does it make a difference?
I'd have to say "no"... at least not in a functional sense. On the other hand, if it'll give you peace of mind and eliminate a validator concern, then put it in... won't hurt any.

Here's a quote from a reference on HTML 4.0:
The required TYPE attribute of SCRIPT specifies the media type of the scripting language, e.g., text/javascript. However, most browsers only support the deprecated LANGUAGE attribute, which specifies the language name. Examples of supported LANGUAGE values include JavaScript, JavaScript1.1, and VBScript. The values are not case sensitive.
I read this to mean that the type attribute is "required"... but not really. Typical...

Hope that helps,

Kevin
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Post by Davidk »

Thanks Kev! You just gave me peace of mind!

David
DHTML Kitchen
Beginner
Beginner
Posts: 2
Joined: Sun Feb 29, 2004 4:51 pm

Put it in

Post by DHTML Kitchen »

I would include it.

When a page uses invalid markup, it may be difficult to determine the source of bugs or other unexpected behavior that your page may display.
Post Reply