Example Insert a JavaScript in an HTML page: <script type="text/javascript"> document.write("Hello World!"...
Example
Insert a JavaScript in an HTML page:<script type="text/javascript"> document.write("Hello World!"); </script> |
Definition and Usage
The required type attribute specifies the MIME type of a script.The type attribute identifies the content between the <script> and </script> tags.
The MIME type consists of two parts: one media type and one subtype. For JavaScript, the MIME type is "text/javascript".
Browser Support
The type attribute is supported in all major browsers.Syntax
<script type="value"> |
Attribute Values
Value | Description |
---|---|
MIME_type | The MIME type. Some values:
Note: According to IANA, the "text/javascript" MIME type is obsolete. The new standard is "application/javascript". However, "application/javascript" is not supported by Internet Explorer. |