2.2 Case Sensitivity
JavaScript is a case-sensitive
language. This means that language
keywords, variables, function names, and
any other identifiers must always be typed with a consistent
capitalization of letters. The while keyword, for
example, must be typed "while", not "While"
or "WHILE". Similarly, online,
Online, OnLine, and
ONLINE are four distinct variable names.
Note, however, that HTML is not case-sensitive. Because of its close
association with client-side JavaScript, this difference can be
confusing. Many JavaScript objects and properties have the same names
as the HTML tags and attributes they represent. While these tags and
attribute names can be typed in any case in HTML, in JavaScript they
typically must be all lowercase. For example, the HTML
onclick event handler attribute is commonly
specified as onClick in HTML, but it must be
referred to as onclick in JavaScript code.
While core JavaScript is entirely and exclusively case-sensitive,
exceptions to this rule are allowed in
client-side
JavaScript. In Internet Explorer 3, for example, all client-side
objects and properties were case-insensitive. This caused problematic
incompatibilities with
Netscape, however, so in Internet
Explorer 4 and later, client-side objects and properties are
case-sensitive.
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.