script

Form

<script> ... </script>

Attributes

attribute default description
id none specifies the unique ID
type none specifies the MIME type of the script
language none specifies the scripting language
src none specifies the URL of an external script file

Support

HTML 3.2, HTML 4.01 [STF], XHTML 1.0 [STF], XHTML 1.1
Microsoft (MSDN)
[IE3 or later][Firefox 1 or later][Safari 1 or later][Opera 3 or later][Netscape 2 or later]

Explanation

The script tag specifies running script. In JavaScript, declare <script type="text/javascript">.
To prevent browsers which cannot run a script from make the script visible, it is usually embedded within a comment like <script type="text/javascript"><!-- script code // --></script>.
For browsers that cannot run a script, the <noscript> tag specifies a displayed content.

Related Tags

noscript

Sample Code [Output]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=shift_jis">
<title>Sample</title>
</head>
<body>
<h1>Sample</h1>
<script type="text/javascript"><!--
document.write("Script OK");
// --></script>
<noscript>
This page doesn't support browsers that cannot run the script.
</noscript>
</body>
</html>