type="text/javascript" or language="JavaScript"

This section describes the differences type='text/javascript' or language='JavaScript' attributes.

When using the <script> tag to embed a script code in HTML documents, you can specify the scripting language in several ways:

1. Using type="text/javascript" attribute only - The Web browser will execute the script code as JavaScript:

<script type="text/javascript">
   ... JavaScript code ...
</script>

2. Using language="JavaScript" attribute only - The Web browser will execute the script code as JavaScript:

<script language="JavaScript">
   ... JavaScript code ...
</script>

3. Using language="JavaScript1.7" attribute only - The Web browser will execute the script code JavaScript only if it supports JavaScript 1.7 version:

<script language="JavaScript1.7">
   ... JavaScript code ...
</script>

4. Using type="text/javascript" and language="JavaScript1.7" attributes - The Web browser will execute the script code JavaScript, and language="JavaScript1.7" attribute is ignored.

<script type="text/javascript" language="JavaScript1.7">
   ... JavaScript code ...
</script>

Table of Contents

 About This Book

 Introduction to JavaScript

 ECMAScript Language Specification and JavaScript Dialects

 Data Types, Variables and Expressions

 Flow Control Statements

 Creating, Accessing, and Manipulating Arrays

 Defining and Calling Functions

Web Browser Supporting JavaScript

 JavaScript Support in Web Browsers

 Including JavaScript Codes with HTML "script" Tags

type="text/javascript" or language="JavaScript"

 JavaScript Version Supported by Browsers

 Including 'script' Tags in String Literals

 Escaping 'script' Tags in String Literals

 Using HTML Entities to Protect HTML Tags

 Including JavaScript Codes as External Files

 DOM API - The "document" Object

 DOM API - The "window" Object

 DOM API - The "window.open" Method

 Event Listeners and Objects

 'javascript:' Pseudo-URL Addresses

 JavaScript Console in Google Chrome

 JavaScript Console in Mozilla Firefox

 JavaScript Console in IE (Internet Explorer)

 Server-Side and Client-Side Web Scripting

 Introduction to Objects

 Defining Your Own Object Types

 Inheritance of Properties and Methods through the Prototype Object Chain

 'jrunscript' - JavaScript Shell Command from JDK

 Using Functions as "Function" Objects

 Introduction to Built-in Object Types

 W3C's Document Object Model (DOM) Specifications

 References

 Full Version in PDF/EPUB