HTML Script Reference
The <script> tag used for script description, may contains link on program or program text on any language. Script can be stored in external file and link with any HTML-page. This allows to use the same scripts on many web-pages. The <script> tag can be situated inside <head> or <body> tag.
| List of <script> tag's attributes | |
| defer | Holds execution of a script until all page will not be loaded completely. |
| language | Determines a programming language on which a script is written. May have one of four values: JavaScript - for JavaScript Language JScript - for JScript language (version of JavaScript developed by Microsoft ) VBS or VBScript - for VBScript language |
| src | Determines path to file with script. |
| type | Determines the type of content. May have a two values: text/javascript - for JavaScript language text/vbscript - for VBScript language. Some old browsers can't recognize this attribute, therefore I recommend you to use both "language" and "type" inside <script> tag. |
Examples
<script language="JavaScript">
//Code on JavaScript
</script>
//Code on JavaScript
</script>
This simple example shows how you can include script on a web-page.
<script language="JavaScript" src="scripts.js">
</script>
</script>
This example shows how you cat attach file with script to a HTML-page.
<script language="JavaScript" src="scripts.js" type="text/javascript" defer>
//Code on JavaScript
</script>
//Code on JavaScript
</script>
In this example scripts will be loaded from file and some code executes from <script> tag. These scripts will be execute when page will be loaded completely.
HTML menu.