JavaScript Programmer's Reference
Get essential programming information at your fingertips! You'll learn to use JavaScript to create customized, interactive Web sites and get quick tips for implementing JavaScript across different browser platforms. This handy guide offers expert tips, language verification, and cross-platform instruction--making this the perfect companion for the serious coder.
1017953344
JavaScript Programmer's Reference
Get essential programming information at your fingertips! You'll learn to use JavaScript to create customized, interactive Web sites and get quick tips for implementing JavaScript across different browser platforms. This handy guide offers expert tips, language verification, and cross-platform instruction--making this the perfect companion for the serious coder.
25.0 In Stock
JavaScript Programmer's Reference

JavaScript Programmer's Reference

JavaScript Programmer's Reference

JavaScript Programmer's Reference

Paperback

$25.00 
  • SHIP THIS ITEM
    In stock. Ships in 1-2 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Get essential programming information at your fingertips! You'll learn to use JavaScript to create customized, interactive Web sites and get quick tips for implementing JavaScript across different browser platforms. This handy guide offers expert tips, language verification, and cross-platform instruction--making this the perfect companion for the serious coder.

Product Details

ISBN-13: 9780072192964
Publisher: McGraw-Hill/Osborne Media
Publication date: 09/11/2001
Series: Programmer's Reference
Pages: 288
Product dimensions: 5.59(w) x 8.53(h) x 0.70(d)

About the Author

Christian MacAuley is a web coder, designer, writer, and trainer. Her extensive experience as a JavaScript coder in the streaming media industry has garnered her clients such as PSINet, eStackig, and TV on the Web, among others. Christian's articles about web design and coding have appeared in Web Review and ArtToday. Christian is also the author of Palm Handhelds for Visual Learners (VisiBooks 2001).

Paul Jobson has been building web sites since 1994 and has extensive experience coding client-side JavaScript, Dynamic HTML, and Perl. He is currently contracting for a Fortune 50 company in the DC Metro area.

Read an Excerpt

Chapter 1: Core JavaScript

This chapter discusses JavaScript's core language conventions, including case sensitivity, keywords, data types, reserved words, and operators to get you rolling if you're new to JavaScript.

Language Conventions

Case Sensitivity

Core JavaScript language is case sensitive. This means keywords, variables, function names, or any other identifiers must contain exactly the same letters in the same case. The variable SomeVariable is not the same as SOMEVARIABLE, which is not the same as somevariable.

Microsoft's Internet Explorer browser is the only deviant from this rule. In Internet Explorer, Core JavaScript is case sensitive, but any objects, and their methods and properties, that are added by the Client-Side JavaScript are not case sensitive. For example, Date ( ) and Math () are Core JavaScript functions, and therefore it is invalid to write them as date (), DATE (), Math (), or mAth () . On the other hand, the form object is part of Client-Side JavaScript, and therefore it is valid to write it as window. form or window. FORM or window. Form. Remember, these rules apply to Internet Explorer only and it's not good practice to ignore cases.

Code Formatting

Line Breaks and Whitespace
JavaScript ignores line breaks and whitespace, except in strings and tokens. Whitespace represents a space or tab. Tokens are defined as keywords, variable names, numbers, function names, or some place that you wouldn't want a line break or whitespace. A token could be the number 2 002 ; if you added a space, the numbers 200 2 would be considered two tokens.

Semicolons
JavaScript, like many programming languages, has semicolons at the end of statements. Still, JavaScript does not require you to put a semicolon at the end of a statement. Each of the following statements is valid:

ThisMonth = "August" 
someyear = "2022"; 
nextnum = 33; 
                       testvalue = 300
					   

If there are several statements on one line, you must use semicolons:

thisyear = "2001"; 
othernum = 100;

Even though semicolons are optional, it is better coding practice not to omit them.

Comments
JavaScript comments are simply notes within the code-and they are not part of the program. Developers (such as you) generally use comments to add notes to the code for later reference. There are two forms of comments in JavaScript. Line comments begin with / / and end with a line break, and multiline comments begin with / * and end with * / . Several lines may fall between these symbols.

// This is a comment 
num = S; // Comments may follow a line of code. 
/* Comments may span several lines, 
as long as you use this kind of commenting */

Literals and Identifiers

A literal represents a value in JavaScript. Literals are fixed values, not variables, which you define. Several types of literals are integer literals, octal literals, hexadecimal literals, and string literals.

Reserved Words

In JavaScript there are several groups of words that fall into the "reserved word" category. Reserved words are words that you should not use as identifiers. You may not use any JavaScript keywords, shown in Table 1-1. JavaScript keywords are pan of the language syntax, so they should be avoided. Also, Java keywords, displayed in Table 1-2, should be avoided. Java keywords are not yet used in JavaScript, but future versions of JavaScript may use them. Table 1-3 lists other identifiers to be avoided-these are names of data types, functions, and variables that are predefined by Client-Side JavaScript. Since Internet Explorer is not case sensitive, all keywords in Table 1-2 should be avoided in lowercase and uppercase. Finally, there are words reserved for possible future extensions to the ECMA-262 standard, which are shown in Table 1-4.

Data Types

Numbers

Numbers are basic data types; numeric literals may be integer or floating point; and integers may be decimal, octal, or hexadecimal. JavaScript does not make a distinction between floating-point and integer values; JavaScript recognizes all numbers as floating-point values. These floating-point numbers may be represented as large as +/- 1.7976931348623157x10308 and as small as +/- 5x10-324.

Integer Literals
Integer literals are represented by Base-10 numbers, which are positive or negative numbers that do not begin with a zero. Integer literals never have decimals, for example...

Table of Contents

Acknowledgmentsxiii
Introductionxiii
1Core JavaScript1
Language Conventions1
Case Sensitivity1
Code Formatting1
Literals and Identifiers2
Reserved Words2
Data Types5
Numbers5
Special Numeric Values7
Strings7
Variables9
"Untyped" Variables9
Declaring Variables9
Operators10
JavaScript Operators13
Operands13
Operator Precedence13
Operator Associativity14
Types of Operators15
2Statements and Control Structures27
Statements27
Expression Statements27
Compound Statements27
var28
function28
return28
with28
import and export29
The Empty Statement29
try ... catch30
Control Structures30
Conditional30
Loops33
3Functions and Objects37
Functions37
Defining Functions37
Executing Functions38
Nested Functions38
Manipulating Functions as Data39
Objects43
A Prototype-Based Language43
Defining Objects44
The Object Superclass45
Using Object-Oriented JavaScript48
4Core Objects and Functions51
Array51
Creating Arrays53
Array Methods and Properties54
Multidimensional Arrays60
Boolean61
Creating Boolean Objects and Values61
Boolean Methods62
Date63
The Date Constructor67
Date Methods68
eval ()81
Math82
Math Methods and Properties84
MimeType92
MimeType Properties94
Number94
The Number Constructor95
Number Methods and Properties95
parseFloat ()98
parseInt ()98
RegExp99
Defining Regular Expressions99
Pattern Matching100
RegExp Methods108
RegExp Object111
String113
Creating Strings116
String Methods and Properties116
5JavaScript in the Browser: Client-Side Objects, Methods, and Properties129
Embedding JavaScript in HTML Pages129
[left angle bracket]Script[right angle bracket] Tags129
URL131
JSS132
Entities132
The Document Object Model133
The navigator Object133
navigator.appCodeName135
navigator.appMinorVersion136
navigator.appName136
navigator.appVersion136
navigator.cookieEnabled136
navigator.cpuClass137
navigator.javaEnabled()138
navigator.language138
navigator.mimeTypes[]138
navigator.online140
navigator.oscpu140
navigator.platform140
navigator.plugins140
navigator.product142
navigator.productSub142
navigator.systemLanguage143
navigator.userAgent143
navigator.userLanguage143
navigator.vendor143
navigator.vendorSub144
The Event Object (Events and Event Handling)144
event.altKey, event.ctrlKey, event.shiftKey144
event.bubbles145
event.button145
event.cancelable145
event.cancelBubble146
event.clientX, event.clientY146
event.currentTarget146
event.data146
event.eventPhase146
event.fromElement146
event.height146
event.keyCode147
event.layerX, event.layerY147
event.modifiers147
event.offsetX, event.offsetY147
event.pageX, event.pageY147
event.reason147
event.returnValue148
event.screenX, event.screenY148
event.srcElement148
event.srcFilter148
event.target148
event.toElement148
event.type148
event.TYPE149
event.which149
event.width149
event.x, event.y149
The window Object150
window._content157
window.alert()157
window.atob() and window.btoa()157
window.back()157
window.blur()157
window.captureEvents()158
window.clearInterval()158
window.clearTimeout()159
window.close()159
window.closed159
window.confirm()159
window.crypto159
window.dialogArguments159
window.dialogHeight160
window.dialogLeft160
window.dialogTop160
window.dialogWidth160
window.disableExternalCapture()160
window.document160
window.enableExternalCapture()161
window.escape() and window.unescape()161
window.event161
window.execScript161
window.find()161
window.focus()162
window.forward()162
window.frames[]162
window.history162
window.home()162
window.innerHeight162
window.innerWidth162
window.length163
window.location163
window.locationbar163
window.menubar163
window.moveBy()163
window.moveTo()163
window.name163
window.navigate()164
window.offscreenBuffering164
window.onblur164
window.ondragdrop164
window.onerror164
window.onfocus164
window.onload164
window.onmove165
window.onresize165
window.onunload165
window.open()165
window.opener167
window.outerHeight167
window.outerWidth167
window.parent167
window.personalbar167
window.print()168
window.prompt()168
window.releaseEvents()168
window.resizeBy()168
window.resizeTo()168
window.routeEvents()169
window.screen169
window.screenX169
window.screenY169
window.scroll()169
window.scrollbars169
window.scrollBy()170
window.scrollTo()170
window.self170
window.setHotkeys()170
window.setInterval()170
window.setResizable()171
window.setTimeout()171
window.setZOptions()171
window.showHelp()172
window.showModalDialog() and window.showModelessDialog()172
window.sidebar173
window.status174
window.statusbar174
window.stop()174
window.toolbar174
window.top174
window.window174
window.XOffset174
window.YOffset175
Document Properties175
document.activeElement179
document.all179
document.alinkColor, document.bgColor, document.fgColor, document.linkColor, document.vlinkColor180
document.anchors[]181
document.applets[]181
document.attributes181
document.body181
document.characterSet182
document.childNodes182
document.clear()182
document.close()183
document.cookie183
document.createElement()183
document.createStyleSheet()183
document.defaultCharset183
document.domain184
document.elementFromPoint()184
document.embeds[]184
document.execCommand()184
document.expando184
document.fileCreatedDate187
document.fileModifiedDate187
document.fileSize188
document.fileUpdatedDate188
document.form188
document.forms[]235
document.frames[]235
document.getSelection235
document.height236
document.images[]236
document.lastModified236
document.links[]236
document.mimeType236
document.open()236
document.parentWindow236
document.queryCommandEnabled()237
document.queryCommandIndeterm()237
document.queryCommandState()237
document.queryCommandSupported()237
document.queryCommandText()237
document.queryCommandValue()238
document.readyState238
document.referrer238
document.scripts[]238
document.selection238
document.styleSheets[]239
document.title239
document.URL239
document.width239
document.write()239
document.writeln()239
Appendix
JavaScript Versions Chart241
Character Charts242
Event Handlers Chart251
The Authors' Bookmarks253
Web Browsers255
Country Codes255
JavaScript Security258
JavaScript's Inherent Security258
Security by Obscurity Doesn't Work259
Index261
From the B&N Reads Blog

Customer Reviews