HTML and CSS Reference
In-Depth Information
<script>
Defines an executable script within a docu-
ment
Function
Attributes
charset
,
defer
,
language
,
src
,
type
End tag
</script>
; never omitted
Contains
scripts
Used in
head_content
,
body_content
12.3.1.1. The language and type attributes
Use the
language
or
type
attribute in the
<script>
tag to declare the
scripting language that you used to compose the contents of the tag. The
HTML 4 and XHTML standards deprecate the
language
attribute in favor of
the
type
attribute. Regrettably, the value for each attribute is different.
If you are using JavaScriptby far the most common scripting language on
the Webuse
language=JavaScript
or
type="text/javascript"
. You may oc-
casionally see the
language
value
VBScript
(
text/vbscript
for
type
), indic-
ating that the enclosed code is written in Microsoft's Visual Basic script.