Include Javascript and CSS file in html page

by Sanju 2009-10-01 10:08:08

Include Javascript and CSS file in html page

We are including javascript and CSS file in HTML page using the following format:

<script language = javascript src = "src name"></script>
<link REL="StyleSheet" TYPE="text/css" HREF="style.css">

But while validating the page we will receive the following error:

Line 41, Column 47: required attribute "TYPE" not specified
<script language=javascript src="src name"></script>
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>.

The proper way to include JS file is:
<script type="text/javascript" src="src name"></script>
<link REL="StyleSheet" TYPE="text/css" HREF="style.css">

Tagged in:


You must LOGIN to add comments