HTML Script Embedding
This tutorial is not intended to teach script writing, but will only define some of the related tags and give an example script so the user can get an idea how to embed script in HTML. This tutorial also does not explain how to get information entered in a script form to the server. That is a subject that will be described when the hyper text transfer protol (HTTP) and server side script writing is discussed.
The script below will check inputs from the form, below, to be sure they have been entered correctly before sending the data to the server. If you attempt to press submit in the form below without filling the appropriate fields in, you will see that the script is active.
SCRIPT Element Attributes
The script element is usually embedded in the document header but may be placed in the head or the body of the HTML document so long as it occurs before code that invokes it.
- CHARSET - (Depreciated). The encoding of any external script specified such as "iso-8859-1".
- DEFER - (Depreciated). The script is not parsed until the HTML document is rendered.
- EVENT - Specifies the event used to trigger the script.
- FOR - Specifies an object (combined with an action) that is used to trigger the script event
- SRC - (Depreciated). Specifies an external script which may include a URL path to another webserver.
- TYPE - The new method to specify the script language using MIME specification rather than the LANGUAGE attribute. This attribute is not widely supported yet.
The NOSCRIPT element is used to provide alternate content when a browser does not support script.
An example Script
How the script looks: