Î ÊÎÏÈÐÀÉÒÀÕ |
Âñÿ ïðåäîñòàâëåííàÿ íà ýòîì ñåðâåðå èíôîðìàöèÿ ñîáðàíà íàìè èç ðàçíûõ èñòî÷íèêîâ. Åñëè Âàì êàæåòñÿ, ÷òî ïóáëèêàöèÿ êàêèõ-òî äîêóìåíòîâ íàðóøàåò ÷üè-ëèáî àâòîðñêèå ïðàâà, ñîîáùèòå íàì îá ýòîì. |
|
|
|
|
Learn Advanced JavaScript Programming
Author: Yehuda Shiran and Tomer Shiran
-
- Chapter 1—Introduction to JavaScript
- The World Wide Web
- Competition on the Web
- Extending HTML
- CGI Programs
- Helpers, Plug-ins, Applets, and CGI
- Helpers
- Plug-ins
- Java
Applets
- CGI
(Common Gateway Interface)
- What
is JavaScript?
- Who
Can Benefit from JavaScript?
- The
History of JavaScript
- JavaScript
in a Browser
- Client-side
JavaScript
- Browser
Objects
- What
Can JavaScript Do?
- Games
- Banners
- Form
Validation
- Miscellaneous
- JavaScript
and Java
- JavaScript
Resembles Java
- JavaScript
Differs from Java
- JavaScript
and Java are Complementary Languages
- JavaScript’s
Current Status
- The
Future of JavaScript
- Motivation
Summary
- Chapter 2—Reading This Book
- How
to Learn JavaScript
- Prerequisites
- A
Programming Refresher
- How
to Read This Book
- The
Structure of This Book
- Programming
Style
- Reading
Examples
- Encouragement
for Nonprogrammers
- Warning
for Programmers
- Let
the Show Begin
- Chapter 3—Writing Your First Script
- Essential
Authoring Tools
- Choosing
a Text Editor
- Choosing
a Browser
- Basic
JavaScript Structure
- The
<SCRIPT> Tag
- Internal
Scripts
- External
Scripts
- Hiding
the Script
- Problems
with Code Hiding
- Alternate
Content
- Placing
JavaScript Code
- Conventions
- Using
the Semicolon
- JavaScript
is Case Sensitive
- Comments
- Using
Quotes
- Your
First Script
- Printing
JavaScript Output
- Updating
a Page
- Summary
- Chapter 4—JavaScript and HTML
- Page
Layout
- Command
Blocks
- Functions
- Defining
and Calling a Function
- Placing
Scripts in Documents
- Executing
Deferred Scripts
- Calling
Deferred Code from a Script
- Calling
Deferred Code from Event Handlers
- Calling
Deferred Script from Links and Image Maps
- JavaScript
Entities
- Summary
- Chapter 5—Basic Declarations and Expressions
- “Building”
a Script
- Data
Types in JavaScript
- The
Value Null
- Variables
- Identifiers
- Naming
Conventions
- Variable
Declaration
- JavaScript
Entities
- Type
Conversion
- Mixing
Strings and Numbers
- Literals
- Integer
Literals
- Decimal
Integers
- Octal
Integers
- Hexadecimal
Integers
- Converting
from Decimal to Other Bases
- Converting
from a Specified Base to Decimal
- Referring
to Octal and Hexadecimal Integers
- Floating
Point Literals
- Boolean
Literals
- String
Literals
- Making
Statements
- Multiple
Statements
- Nested
Statements
- Simple
Assignment Statements
- Evaluating
Expressions
- Testing
Evaluation
- Functions
- Function
Definition
- Calling
Functions
- Summary
- Chapter 6—Object-Based Programming
- Objects
- Properties
- Syntax
- Methods
- Syntax
- Using
the Array Notation
- Object
Based Versus Object Oriented
- Summary
- Chapter 7—Utilizing JavaScript Operators
- Operator
Categories
- Mathematical
Operators
- Addition
- Subtraction
- Multiplication
- Division
- Modulus
- The
Nonexistent Integral Division Operator
- Increment
- Decrement
- Negation
- String
Operators
- Bitwise
Operators
- Bitwise
AND
- Bitwise
OR
- Bitwise
XOR
- Bitwise
NOT
- Shift
Operators
- Left
shift
- Right
shift
- Zero-fill
right shift
- Assignment
Operators
- Relational
Operators
- Equality
and Inequality
- Short-Circuit
Logical Operators
- Logical
OR
- Logical
AND
- Logical
NOT
- Testing
Equality for Floating Point Numbers
- More
Logical Operators
- Conditional
Operator
- Comma
Operator
- Data
Type Operator
- Void
Operator
- Operator
Precedence
- Expressions
- Side
Effects
- Summary
- Chapter 8—Control Structures
- Dialog
Boxes
- Alert
Boxes
- Confirm
Boxes
- Prompt
Boxes
- if
Statement
- else
Statement
- Nested
if-else Statements
- The
Nonexistent Switch Statement
- Loop
Statements
- for
Statement
- while
Statement
- for…in
Statement
- break
Statement
- continue
Statement
- with
Statement
- Summary
- Chapter 9—Functions and Variable Scope
- Variable
Scope and Storage Class
- What
are Functions?
- Defining
Functions and Calling Them
- Function
Parameters
- Using
the Argument Array
- Creating
Functions with Default Arguments
- Returning
a Value
- Recursion
- Tracing
Values in Recursive Functions
- Variables
and Recursive Functions
- Summary
- Chapter 10—JavaScript by Example—a Review
- Height
and Weight Calculator
- The
Task
- The
Algorithm
- The
Script
- Analysis
- convertInput()
- getHeight(sex,
age, height)
- getWeight(sex,
age, weight)
- printResult(height,
weight, sex, age)
- Global
Statements
- Output
- Base
Converter
- Task
- Algorithm
- The
Script
- Analysis
- power(op1,
op2)
- div(op1,
op2)
- getDigit(val)
- getValue(dig)
- toBase(num,
base)
- toDec(num,
base)
- convert(num,
base1, base2)
- getTableAttributes()
- drawTable(lastNum)
- calcNum()
- mainInput()
- Global
Statements
- Output
- Summary
- Chapter 11—Events in JavaScript
- Events
- Event
Handlers
- onLoad
and onUnload
- onError
- Emulating
Events via Methods
- Calling
Event Handlers Explicitly
- Cancelling
Events
- Summary
- Chapter 12—Building and Extending Objects
- Creating
Instances
- Constructor
Functions
- Defining
Object Properties
- Nested
Objects
- Defining
Methods
- Creating
Objects—An Example
- Prototype
and Object Extensions
- Summary
- Chapter 13—Arrays
- What
is an Array?
- Some
History
- Creating
Simple Arrays
- Referring
to an Array’s Elements
- Creating
Dense Arrays
- Array
Types
- Array
Properties
- Array
Methods
- chop()
- grep()
- join()
- pop()
- push()
- reverse()
- shift()
- splice()
- split()
- sort()
- unshift()
- The
arguments Array
- Multidimensional
Arrays
- Creation
with a Single Constructor Function
- Creation
without Constructor Function
- Associative
Arrays
- Populating
an Associative Array
- Splitting
a String into an Associative Array
- Summary
- Chapter 14—Time and Date in JavaScript
- The
Date Object
- Creating
a Date Instance
- Parameters
of the Date Constructor
- Macs
are one day in the future
- Date
Numeric Conventions
- Date
Method Categories
- get
Methods
- getYear()
- getMonth()
- getDate()
- getDay()
- getHours()
- getMinutes()
- getSeconds()
- getTimezoneOffset()
- getTime()
- set
Methods
- setYear()
- setMonth()
- setDate()
- setHours()
- setMinutes()
- setSeconds()
- setTime()
- to
Methods
- toGMTString()
- toLocaleString()
- parse
Methods
- parse()
- UTC()
- Time-Related
Methods of Other Objects
- setTimeout()
- clearTimeout()
- Time
and Date Examples
- A
Simple Digital Clock
- Digital
Date
- Calendar
- getTime()
- leapYear(year)
- getDays(month,
year)
- getMonthName(month)
- setCal()
- drawCal(firstDay,
lastDate, date, monthName, year)
- Random
Quotes
- Summary
- Chapter 15—JavaScript Math
- Math
in JavaScript
- The
Math Object
- Constants
- E
- LN2
- LN10
- LOG2E
- LOG10E
- PI
- SQRT1_2
- SQRT2
- Math
Methods
- Arithmetic
Methods
- abs()
- ceil()
- exp()
- floor()
- log()
- max(),
min()
- pow()
- random()
- round()
- sqrt()
- Trigonometric
Methods
- cos()
- acos()
- sin()
- asin()
- tan()
- atan()
- atan2()
- The
Number Object
- MAX_VALUE
- MIN_VALUE
- NaN
- NEGATIVE_INFINITY
- POSITIVE_INFINITY
- Number
Methods
- Math-Related
Functions
- parseInt()
- parseFloat()
- eval()
- Math
Examples
- Creating
a Curve
- General
Plotting Utility
- Summary
- Chapter 16—Handling Strings
- String
Indexing
- Characters
- Creating
Strings
- String
Length
- HTML
Formatting Methods
- General
String Methods
- charAt()
- indexOf()
- lastIndexOf()
- substring()
- escape
& unescape
- Number-to-String
Conversion
- Empty
String Concatenation
- String
Instance Construction
- The
toString() Method
- String-to-Number
Conversion
- parseInt()
and parseFloat()
- Checking
if a Value is a Number or Not
- Evaluating
Text Expressions
- String
Handling Examples
- String
Enciphering
- encipher()
- encode(str,
key)
- Global
Statements
- Summary
- Chapter 17—Browser Objects
- The
Object Hierarchy
- Creating
Browser Objects
- The
Topmost Objects
- window
- document
- history
- location
- Summary
- Chapter 18—Utilizing the Status Bar
- The
Status Bar
- Writing
to the Status Bar
- Setting
a Default Value to Status Bar
- Banners
- T-banner
- Global
Statements
- stopBanner()
- startBanner()
- showBanner()
- Event
Handlers
- R-banner
- Global
Statements
- stopBanner()
- startBanner()
- clearState()
- getRandom(max)
- getString()
- showBanner()
- Event
Handlers
- N-banner
- scrollBanner(seed)
- Summary
- Chapter 19—URLs and JavaScript
- A
Crash Course in URLs
- General
URL Syntax
- The
URL Schemes
- HyperText
Transfer Protocol (HTTP)
- File
Transfer Protocol (FTP)
- Gopher
Protocol (Gopher)
- Electronic
Mail (Mailto)
- Usenet
News (News)
- Host-Specific
File Names (File)
- JavaScript
Statements (javascript)
- Other
Schemes
- location
Object
- location
Properties
- href
- hash
- host
- hostname
- pathname
- port
- protocol
- search
- Search
Utilities
- location
Methods
- reload
- replace
- Another
Location—document.location (document.URL)
- Summary
- Chapter 20—Using the History List
- What
is a History List?
- The
history Object
- History
List Length
- History
List Entry Indexing
- history
Methods
- back
- forward
- go
- Security
Aspects of the history Object
- Summary
- Chapter 21—The document Object—Colors,—Output, and Properties
- The
document Object
- The
title Property
- Colors
- bgColor
- Global
Statements
- display(triplet)
- drawCell(red,
green, blue)
- drawRow(red,
blue)
- drawTable(blue)
- drawCube()
- toHex(dec)
- setbgColor(red,
green, blue)
- fade(sred,
sgreen, sblue, ered, egreen, eblue, step)
- Event
Handlers
- fgColor
- alinkColor
- linkColor
- vlinkColor
- Output
Methods and Streams
- write
and writeln
- Data
Streams
- Summary
- Chapter 22—Forms
- What
are HTML Forms?
- JavaScript
Form Reference
- forms
Array
- Form
Name
- Form
Object
- HTML
Syntax
- Event
Handlers
- onSubmit
- onReset
- Methods
- submit()
- reset()
- Properties
- action
- elements
- encoding
- method
- target
- Element
Types
- Using
this with Event Handlers
- Utilizing
the form Property
- Text
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- onBlur
- onChange
- onFocus
- onSelect
- Methods
- blur()
- focus()
- select()
- Properties
- defaultValue
- name
- value
- Password
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- Properties
and Methods
- Textarea
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- Properties
and Methods
- Inserting
new line Characters
- Handling
textareas By Line
- Hidden
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- Properties
and Methods
- Button
Object, Submit Object, Reset Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- onClick
- Methods
- click()
- Properties
- name
- value
- Checkbox
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- onClick
- Methods
- click()
- Properties
- checked
- defaultChecked
- name
- value
- Radio
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- onClick
- Methods
- click()
- Properties
- checked
- defaultChecked
- name
- value
- Select
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- onBlur
- onFocus
- onChange
- Methods
- blur,
focus
- Properties
(select object)
- length
- name
- options
- selectedIndex
- Properties
(options array)
- defaultSelected
- index
- length
- selected
- text
- value
- The
Option Object—Adding Options Using the Option Constructor
- FileUpload
Object
- HTML
Syntax
- JavaScript
Access
- Event
Handlers
- Methods
- Properties
- name
- value
- Summary
- Chapter 23—Links, Anchors, and Image Maps
- Defining
a Link
- Defining
an Anchor
- Defining
an Image Map (area)
- links
Array
- anchors
Array
- Link
and Area Event Handlers
- Calling
Event Handlers Explicitly
- onClick
- onMouseOver
- onMouseOut
- Link
and Area Properties
- Location-Equivalent
Properties
- target
- Referring
Documents
- Summary
- Chapter 24—Implementing Cookies
- Maintaining
a State
- Cookies
- Cookies
and HTTP
- Setting
an HTTP Cookie
- Getting
an HTTP Cookie
- Notes
and Limitations
- Examples
- First
Transaction Sequence Example
- Second
Transaction Sequence Example
- Cookies
and JavaScript
- Cookie
Functions
- getInput(num,
monthName)
- initCookie(monthName)
- getSpecificReminder(num,
monthName)
- setSpecificReminder(num,
monthName, newValue)
- Outliner
- item(parent,
text, depth)
- makeArray(length)
- makeDatabase()
- setStates()
- setImages()
- toggle(num)
- setStorage()
- Global
Statements
- Summary
- Chapter 25—Images and Graphics
- Defining
Images in HTML
- Creating
an Instance of Image Object
- The
images Array
- Properties
- border
- complete
- height
- hspace
- lowsrc
- name
- src
- vspace
- width
- Event
Handlers
- onAbort
- onError
- onLoad
- Demonstration
1: Up-to-date Digital Clock
- Global
Statements
- setClock()
- update()
- stopClock()
- getHour(place)
- getMinute(place)
- getAmpm()
- getPath(url)
- Demonstration
2: LED Sign
- Global
Statements
- letterArray()
- drawBlank()
- setLight(state,
x, y)
- drawLetter(letter,
startX)
- drawSpace(startX)
- computeIndex()
- floodBoard(startX)
- drawMessage(num)
- startSign()
- stopSign()
- More
Global Statements
- Demonstration
3: Netris Deluxe
- Global
Statements
- drawScreen()
- computeIndex(x,
y)
- state(x,
y)
- setSquare(x,
y, state)
- clearActive()
- checkMoveX(step)
- checkMoveY()
- moveX(step)
- smartX(x,
y, step)
- moveY()
- smartY(x,
y)
- shapeMap()
- getRandom()
- insertShape()
- complexWarp()
- checkWarp(startX,
startY, endX, endY)
- rotate()
- flood(state)
- noActive()
- isLine(y)
- warp(startX,
startY, endX, endY)
- start()
- dropLines()
- play()
- characteristics(x,
y)
- fullMap()
- pause()
- MUSIC
- Summary
- Chapter 26—Frames
- What
are Frames?
- Creating
Frames
- Targeting
Frames
- Nested
Frames
- JavaScript
and Frames
- self
- parent
- top
- frames
- An
Example—the Color Center
- The
Frame-setting window
- display(r,
g, b)
- makeAttribute(r,
g, b)
- Global
Statements
- select(r,
g, b)
- curAttribute()
- bodyDefinition()
- update()
- save()
- load()
- HTML
- The
“control” Frame
- display()
- Event
Handlers
- The
“swatches” Frame
- The
“main” Frame
- Frames,
Events, and Event Handlers
- Using
Event Handlers Within a Frame
- Using
Event Handlers in a Frame-Setting Document
- onFocus
and onBlur
- Emulating
Events
- Targeting
Multiple Frames
- Summary
- Chapter 27—Windows
- What
are Windows?
- Opening
a Window with JavaScript
- An
IE 3.0x Bug Workaround
- Referencing
Windows
- Window
Names
- Remotes
- HTML-Based
Remotes (Recommended)
- JavaScript-Based
Remote
- Another
Algorithm to Open Windows
- Closing
a Window
- Scrolling
a Window
- Windows,
Events, and Event Handlers
- Accessing
a Window’s Objects—An Example
- getNewLine()
- getInput(func,
form)
- vertical()
- Summary
- Chapter 28—Evaluation and Compilation
- Evaluating
a String
- Function
References and Calls
- Compiling
Code as a Function
- Specifying
the Function’s Body
- Using
the Function Object with a Variable
- Specifying
Arguments
- Using
the Function Object with an Event Handler
- Properties
of the Function Object
- Summary
- Chapter 29—General Software Detection
- Browser
Detection
- What
is the navigator Object?
- Using
the navigator Object to Detect the User’s Browser and Platform
- The
User Agent
- Determining
the User’s Browser
- Redirecting
the User to a Browser-Specific Page
- Using
Frames to Display Different Pages for Each Browser
- Checking
if Java is Enabled
- Summary
- Chapter 30—Plug-ins
- Embedding
a Plug-in Object in HTML
- Referencing
Plug-ins in JavaScript
- Determining
Installed Plug-ins with JavaScript
- Properties
of the mimeTypes Object
- Properties
of the plugins Object
- LiveAudio
and LiveVideo
- LiveAudio
- LiveVideo
- Other
Plug-ins
- Summary
- Chapter 31—LiveConnect—Connecting JavaScript, Java, and Plug-ins
- What
is LiveConnect?
- Enabling
LiveConnect
- The
Java Console
- Netscape
Packages
- Compiling
Java Code with Netscape Packages
- Java
to JavaScript Communication
- Passing
Values Between Java and JavaScript
- Getting
a Handle for the Browser Window
- Accessing
JavaScript Objects and Properties
- Calling
JavaScript Methods
- Other
methods in the JSObject class
- JavaScript
Exception
- JavaScript
to Java Communication
- Accessing
Java Directly
- Controlling
Java Applets
- The
applet Object
- What
Else is Scriptable in an Applet?
- Modifying
an Applet
- Why
Make an Applet Scriptable?
- Controlling
Plug-ins
- Accessing
a Plug-in’s Elements
- JavaScript
and LiveAudio
- JavaScript
and LiveVideo
- Summary
- Chapter 32—JavaScript Extensions for Layers
- Introduction
to Layers
- Defining
a Layer
- NAME
- LEFT
and TOP
- WIDTH
- CLIP
- Z-INDEX,
ABOVE, and BELOW
- VISIBILITY
- BGCOLOR
and BACKGROUND
- The
Layer Object
- Layer
Object Properties
- name
- width
and height
- left
and top
- zIndex
- visibility
- clip.top,
clip.left, clip.right, clip.bottom, clip.width, and clip.height
- background
- bgColor
- siblingAbove
and siblingBelow
- above
and below
- parentLayer
- layers
- Layer
Object Methods
- offset()
- moveTo()
- resize()
- moveAbove()
and moveBelow()
- Demonstration:
A Pictorial Album of U.S. Presidents
- Summary
- Chapter 33—Style Sheets
- Introduction
- Content
Layout
- Font
Properties
- Text
Properties
- Inheritance
of Styles
- Creating
Style Sheets and Assigning Styles
- Defining
Styles with the <STYLE> Tag in the Header
- Specifying
Styles for Individual Elements
- Defining
Classes of Styles
- Format
Properties
- Box
Math
- Replaced
Elements
- Setting
Margins
- Settting
Border Width
- Settting
the Padding Size
- Summary
- Chapter 34—Security Issues
- History
- e-mail
Address Security
- URL
to URL Access Security
- The
Concept of Tainting
- Enabling
Data Tainting
- Specific
Tainting
- Window
Taint Accumulator
- Summary
- Chapter 35—JavaScript Authoring Tools
- Introduction
- Top
10 Tips
- Tip
#1. Navigate Your Code with the Script Navigator
- Tip
#2. Integrated JavaScript Reference
- Tip
#3. Drag-&-Drop Into Your Source File
- Tip
#4. Instantiate JavaScript Objects
- Tip
#5. Using Special Inline Characters
- Tip
#6. Speed Up Your Typing with Natural Cursor Positioning
- Tip
#7. Reuse Your JavaScript Code
- Tip
#8. Customize Your Editor
- Tip
#9. Create Custom Objects
- Tip
#10. Finding That Matching Brace
- Summary
- Chapter 36—Debugging Scripts
- Types
of Errors
- Error
Messages
- “string
is not defined”
- “string
is not a function”
- “unterminated
string literal”
- “missing
} after function body”
- “string
is not a number”
- “string
has no property named property”
- “string
has no property indexed by [i ]”
- “string
cannot be set by assignment”
- “test
for equality (==) mistyped as assignment (=)? Assuming equality test”
- “function
does not always return a value”
- “access
disallowed from scripts at Url_1 to documents at URL_2”
- “Lengthy
JavaScript still running. Continue?”
- “syntax
error”
- Manual
Debugging Techniques
- Match
Those Tag Pairs
- View
the Intermediate HTML Source
- Reopen
the File
- Good
Old Print Messages
- Comment
Out Statements
- Watching
and Tracing Variables
- Getting
it Right the First Time
- Build
the Script’s Skeleton First
- Keep
Testing While Developing
- Evaluate
Expressions Outside Your Source
- Test
Your Functions Outside Your Source
- Testing
Your Script
- Summary
- Appendix
A
- Appendix
B
- Appendix
C
- Index
|