1. Technology

<script></script>

By

SCRIPT Description:

The SCRIPT element inserts scripts into web pages. You can use this tag any number of times within the HEAD or the BODY of your HTML document.

External scripts are written as separate documents and then associated in the document with the src attribute. If there is no src attribute, the user-agent interprets the contents of the SCRIPT element as the script.

SCRIPT Web Browser Support:

HTML Versions

SCRIPT Attributes:

Global attributes and:

SCRIPT End Tag:

</script> REQUIRED

Contents:

An embedded script. The following tags are valid within the SCRIPT element:
<!-- comment -->

Note: A SCRIPT must not contain <!-- without the closing -->.

SCRIPT Valid Context:

The SCRIPT tag is valid within the following tags:
BLOCKQUOTE, BODY, BUTTON, CENTER, DD, DIV, DT, FIELDSET, FORM, HEAD, IFRAME, LI, NOFRAMES, OBJECT, P, TD, TH

SCRIPT Usage:

Simple script inline on the page

<script>
  alert("This is a script.");
</script>

External script

<script src="myscript.js"></script>

Script with NOSCRIPT Alternative

<script>
  alert("This is a script.");
</script> <noscript>
  <p>
    This is a script, but you are seeing the no-script content.
  </p>
</noscript>

SCRIPT Special Notes:

  • While using comment tags inside a SCRIPT element is valid, this can cause problems with some CMS systems, and since most browsers recognize the SCRIPT element, it's better to leave them out.
  • The language attribute is obsolete in HTML5. You should use the type attribute instead.
  • If you are writing ECMAScript (JavaScript) inside the SCRIPT element, the type attribute is not required.
  • JavaScript, ActionScript, and VBScript are the most common languages for scripts on the web, but you can use any type of scripting language you would like, you just need to specify the correct MIME type in the type attribute.
  • I strongly recommend using the NOSCRIPT element whenever you use a script on your web pages to keep your pages accessible. This is what displays if the script doesn't work or if the browser has scripting disabled.

More SCRIPT Information:

©2014 About.com. All rights reserved.