Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword or section
Like this
28Activity

Table Of Contents

Chapter 1
The World Wide Web
Competition on the Web
Extending HTML
CGI Programs
Helpers, Plug-ins, Applets, and CGI
Helpers
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
What Can JavaScript Do?
Games
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
Chapter 2
HTML Tags
Chapter 3
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
“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
Operators
Making Statements
Multiple Statements
Nested Statements
Evaluating Expressions
Testing Evaluation
Functions
Function Definition
Calling Functions
Control Structures in JavaScript
Dialog Boxes
Alert Boxes
Confirm Boxes
Prompt Boxes
if Statement
else Statement
Nested if-else Statements
Loop Statements
for Statement
while Statement
for…in Statement
break Statement
Variable Scope and Storage Class
What are Functions?
Defining and Calling Functions
Function Parameters
Using the Argument Array
Creating Functions with Default Arguments
Returning a Value
Recursion
Tracing Values in Recursive Functions
Variables and Recursive Functions
Operator Categories
n Mathematical operators
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
The Script
Output
Analysis
convertInput()
getHeight(sex, age, height)
getWeight(sex, age, weight)
Global Statements
Events
Event Handlers
onLoad and onUnload
Emulating Events via Methods
Error Message Content
Calling Event Handlers Explicitly
Cancelling Events
Creating Instances
Constructor Functions
Defining Object Properties
Nested Objects
Defining Methods
Creating Objects An Example
Prototype and Object Extensions
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()
sort()
splice()
split()
unshift()
The arguments Array
Multidimensional Arrays
Creation with a Single Constructor Function
Creation without a Constructor Function
Associative Arrays
Populating an Associative Array
Splitting a String into an Associative Array
The Date Object
Creating a Date Instance
Parameters of the Date Constructor
Date Numeric Conventions
Date Method Categories
n get methods
n set methods
get Methods
getYear()
getMonth()
getDate()
getDay()
getHours()
getMinutes()
getSeconds()
getTimezoneOffset()
The 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()
Random Quotes
Math in JavaScript
The Math Object
Constants
LN10
LOG2E
LOG10E
PI
SQRT1_2
SQRT2
Math Methods
n Arithmetic 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
Number Properties
MAX_VALUE
MIN_VALUE
NEGATIVE_INFINITY
POSITIVE_INFINITY
Number Methods
Math-Related Functions
parseInt()
parseFloat()
eval()
Math Examples
Creating a Curve
drawBlank(num)
drawDot()
getRadian(deg)
getSpot(deg)
get3DigitNum(num)
printDeg(deg)
drawLine(deg)
drawCurve(lastDeg, jump)
General Plotting Utility
root(a, b)
logab(a, b)
factorial(a)
startWizard()
drawDot(x, y)
replaceSpecialSequence(str)
splitFunc(func)
getInput()
yVal(xVal)
makeArray(min, max, dif)
printUnit(num)
drawCurve()
main()
String Indexing
Characters
Creating Strings
encode(str, key)
The Object Hierarchy
Creating Browser Objects
The Topmost Objects
window
document
history
location
The Status Bar
Writing to the Status Bar
Setting a Default Value for the Status Bar
Banners
T-banner
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
location Methods
reload
replace
Another Location document.location (document.URL)
Search Utilities
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
The document Object
The title Property
Colors
display(triplet)
drawCell(red, green, blue)
drawRow(red, blue)
drawTable(blue)
drawCube()
toHex(dec)
setbgColor(red, green, blue)
fgColor
alinkColor
linkColor
vlinkColor
Output Methods and Streams
write and writeln
Data Streams
What are HTML Forms?
JavaScript Form Reference
forms Array
Form Name
form Object
HTML Syntax
onSubmit
onReset
submit()
reset()
action
elements
encoding
method
target
Element Types
Using this with Event Handlers
Utilizing the form Property
text Object
JavaScript Access
onBlur
onChange
onSelect
blur()
focus()
select()
defaultValue
password Object
Methods and Properties
textarea Object
Properties and Methods
Inserting New Line Characters
Handling textareas By Line
hidden Object
button, submit, and reset Objects
onClick
click()
name
value
checkbox Object
checked
defaultChecked
radio Object
select Object
onFocus
blur, focus
Properties (select Object)
length
options
selectedIndex
Properties (options Array)
defaultSelected
index
selected
</SELECT>
text
The Option Object Adding Options Using the Option Constructor
fileUpload Object
Defining a Link
Defining an Anchor
Defining an Image Map Area
links Array
anchors Array
Link and Area Event Handlers
onMouseOver
onMouseOut
Link and Area Properties
Location-Equivalent Properties
Referring Documents
Maintaining State
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
makeArray(length)
makeDatabase()
setStates()
setImages()
toggle(num)
setStorage()
Defining Images in HTML
The Image Object
The images Array
border
complete
height
hspace
lowsrc
vspace
width
onAbort
onError
onLoad
Demonstration 1: Updating Digital Clock
setClock()
stopClock()
getHour(place)
getMinute(place)
getAmpm()
getPath(url)
Demonstration 2: LED Sign
letterArray()
drawBlank()
drawLetter(letter, startX)
drawSpace(startX)
computeIndex()
floodBoard(startX)
drawMessage(num)
startSign()
stopSign()
More Global Statements
Demonstration 3: Netris Deluxe
drawScreen()
computeIndex(x, y)
state(x, y)
clearActive()
checkMoveX(step)
checkMoveY()
moveX(step)
moveY()
smartY(x, y)
shapeMap()
getRandom()
insertShape()
complexWarp()
rotate()
flood(state)
noActive()
isLine(y)
start()
dropLines()
play()
characteristics(x, y)
fullMap()
pause()
Music
What are Frames?
Creating Frames
Targeting Frames
Nested Frames
JavaScript and Frames
self
parent
frames
An Example: The Color Center
The Frame-setting Window
display(r, g, b)
makeAttribute(r, g, b)
select(r, g, b)
curAttribute()
bodyDefinition()
update()
save()
load()
HTML
The “control” Frame
display()
The “swatches” Frame
The “main” Frame
Frames, Events, and Event Handlers
Using Event Handlers in a Frame
Using Event Handlers in a Frame-Setting Document
onFocus and onBlur
Emulating Events
Targeting Multiple Frames
What are Windows?
Opening a Window with JavaScript
Referencing Windows
Window Names
Remotes
HTML-Based Remotes (Recommended)
JavaScript-Based Remote
Closing a Window
Scrolling a Window
Windows, Events, and Event Handlers
An Example: Accessing a Window’s Objects
getNewLine()
getInput(func, form)
vertical()
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
Browser Detection
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
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
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
Defining a Layer
NAME
LEFT and TOP
WIDTH
CLIP
Z-INDEX, ABOVE, and BELOW
VISIBILITY
BGCOLOR and BACKGROUND
The layer Object
width and height
left and top
zIndex
visibility
background
bgColor
siblingAbove and siblingBelow
above and below
parentLayer
layers
offset()
moveTo()
resize()
moveAbove() and moveBelow()
Demonstration: A Pictorial Album of U.S. Presidents
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
History
URL to URL Access Security
The Concept of Tainting
Enabling Data Tainting
Specific Tainting
Window Taint Accumulator
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”
“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
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
Smaller File Sizes
Transparent Frames
Popup Windows
Dialog Box
Object Detection
System Information
0 of .
Results for:
No results containing your search query
P. 1
Advanced Javascript

Advanced Javascript

Ratings: (0)|Views: 27,433|Likes:
Published by Huynh Hien Duc

More info:

Published by: Huynh Hien Duc on Mar 10, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/30/2013

pdf

text

original

You're Reading a Free Preview
Pages 15 to 92 are not shown in this preview.
You're Reading a Free Preview
Pages 107 to 139 are not shown in this preview.
You're Reading a Free Preview
Pages 154 to 289 are not shown in this preview.
You're Reading a Free Preview
Pages 304 to 312 are not shown in this preview.
You're Reading a Free Preview
Pages 327 to 733 are not shown in this preview.

Activity (28)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
jkl316 liked this
kofostce liked this
mtuanlatoi9704 liked this
damjan_marinič liked this
GVF liked this
Greg Kawere liked this
sanyank liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->