Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 2.496 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
2.496
Dung lượng
9,27 MB
Nội dung
This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com JavaScript: The Definitive Guide, 5th Edition By David Flanagan Publisher: O'Reilly Pub Date: August 2006 Print ISBN-10: 0-596-10199-6 Print ISBN-13: 978-0-59-610199-2 Pages: 1018 Table of Contents | Index This Fifth Edition is completely revised and expanded to cover JavaScript as it is used in today's Web 2.0 applications This book is both an example-driven programmer's guide and a keep-on-your-desk reference, with new chapters that explain everything you need to know to get the most out of JavaScript, including: Scripted HTTP and Ajax XML processing Client-side graphics using the tag Namespaces in JavaScript essential when writing complex programs Classes, closures, persistence, Flash, and JavaScript embedded in Java applications Part I explains the core JavaScript language in detail If you are new to JavaScript, it will teach you the language If you are already a JavaScript programmer, Part I will sharpen your skills and deepen your understanding of the language Part II explains the scripting environment provided by web browsers, with a focus on DOM scripting with unobtrusive JavaScript The broad and deep coverage of client-side JavaScript is illustrated with many sophisticated examples that demonstrate how to: Generate a table of contents for an HTML document Display DHTML animations Automate form validation Draw dynamic pie charts Make HTML elements draggable Define keyboard shortcuts for web applications Create Ajax-enabled tool tips Use XPath and XSLT on XML documents loaded with Ajax And much more This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Part III is a complete reference for core JavaScript It documents every class, object, constructor, method, function, property, and constant defined by JavaScript 1.5 and ECMAScript version Part IV is a reference for client-side JavaScript, covering legacy web browser APIs, the standard Level DOM API, and emerging standards such as the XMLHttpRequest object and the tag More than 300,000 JavaScript programmers around the world have made this their indispensable reference book for building JavaScript applications "A must-have reference for expert JavaScript programmers well-organized and detailed." Brendan Eich, creator of JavaScript This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com JavaScript: The Definitive Guide, 5th Edition By David Flanagan Publisher: O'Reilly Pub Date: August 2006 Print ISBN-10: 0-596-10199-6 Print ISBN-13: 978-0-59-610199-2 Pages: 1018 Table of Contents | Index Copyright Dedication Preface Chapter Introduction to JavaScript Section 1.1 What Is JavaScript? Section 1.2 Versions of JavaScript Section 1.3 Client-Side JavaScript Section 1.4 JavaScript in Other Contexts Section 1.5 Exploring JavaScript Part I: Core JavaScript Chapter Lexical Structure Section 2.1 Character Set Section 2.2 Case Sensitivity Section 2.3 Whitespace and Line Breaks Section 2.4 Optional Semicolons Section 2.5 Comments Section 2.6 Literals Section 2.7 Identifiers Section 2.8 Reserved Words Chapter Datatypes and Values Section 3.1 Numbers Section 3.2 Strings Section 3.3 Boolean Values Section 3.4 Functions Section 3.5 Objects Section 3.6 Arrays Section 3.7 null Section 3.8 undefined Section 3.9 The Date Object Section 3.10 Regular Expressions Section 3.11 Error Objects Section 3.12 Type Conversion Summary Section 3.13 Primitive Datatype Wrapper Objects Section 3.14 Object-to-Primitive Conversion Section 3.15 By Value Versus by Reference Chapter Variables Section 4.1 Variable Typing Section 4.2 Variable Declaration Section 4.3 Variable Scope Section 4.4 Primitive Types and Reference Types This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 4.5 Garbage Collection Section 4.6 Variables as Properties Section 4.7 Variable Scope Revisited Chapter Expressions and Operators Section 5.1 Expressions Section 5.2 Operator Overview Section 5.3 Arithmetic Operators Section 5.4 Equality Operators Section 5.5 Relational Operators Section 5.6 String Operators Section 5.7 Logical Operators Section 5.8 Bitwise Operators Section 5.9 Assignment Operators Section 5.10 Miscellaneous Operators Chapter Statements Section 6.1 Expression Statements Section 6.2 Compound Statements Section 6.3 if Section 6.4 else if Section 6.5 switch Section 6.6 while Section 6.7 do/while Section 6.8 for Section 6.9 for/in Section 6.10 Labels Section 6.11 break Section 6.12 continue Section 6.13 var Section 6.14 function Section 6.15 return Section 6.16 throw Section 6.17 try/catch/finally Section 6.18 with Section 6.19 The Empty Statement Section 6.20 Summary of JavaScript Statements Chapter Objects and Arrays Section 7.1 Creating Objects Section 7.2 Object Properties Section 7.3 Objects as Associative Arrays Section 7.4 Universal Object Properties and Methods Section 7.5 Arrays Section 7.6 Reading and Writing Array Elements Section 7.7 Array Methods Section 7.8 Array-Like Objects Chapter Functions Section 8.1 Defining and Invoking Functions Section 8.2 Function Arguments Section 8.3 Functions as Data Section 8.4 Functions as Methods Section 8.5 Constructor Functions Section 8.6 Function Properties and Methods Section 8.7 Utility Function Examples Section 8.8 Function Scope and Closures This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 8.8 Function Scope and Closures Section 8.9 The Function() Constructor Chapter Classes, Constructors, and Prototypes Section 9.1 Constructors Section 9.2 Prototypes and Inheritance Section 9.3 Simulating Classes in JavaScript Section 9.4 Common Object Methods Section 9.5 Superclasses and Subclasses Section 9.6 Extending Without Inheriting Section 9.7 Determining Object Type Section 9.8 Example: A defineClass( ) Utility Method Chapter 10 Modules and Namespaces Section 10.1 Creating Modules and Namespaces Section 10.2 Importing Symbols from Namespaces Section 10.3 Module Utilities Chapter 11 Pattern Matching with Regular Expressions Section 11.1 Defining Regular Expressions Section 11.2 String Methods for Pattern Matching Section 11.3 The RegExp Object Chapter 12 Scripting Java Section 12.1 Embedding JavaScript Section 12.2 Scripting Java Part II: Client-Side JavaScript Chapter 13 JavaScript in Web Browsers Section 13.1 The Web Browser Environment Section 13.2 Embedding Scripts in HTML Section 13.3 Event Handlers in HTML Section 13.4 JavaScript in URLs Section 13.5 Execution of JavaScript Programs Section 13.6 Client-Side Compatibility Section 13.7 Accessibility Section 13.8 JavaScript Security Section 13.9 Other Web-Related JavaScript Embeddings Chapter 14 Scripting Browser Windows Section 14.1 Timers Section 14.2 Browser Location and History Section 14.3 Obtaining Window, Screen, and Browser Information Section 14.4 Opening and Manipulating Windows Section 14.5 Simple Dialog Boxes Section 14.6 Scripting the Status Line Section 14.7 Error Handling Section 14.8 Multiple Windows and Frames Section 14.9 Example: A Navigation Bar in a Frame Chapter 15 Scripting Documents Section 15.1 Dynamic Document Content Section 15.2 Document Properties Section 15.3 Legacy DOM: Document Object Collections Section 15.4 Overview of the W3C DOM Section 15.5 Traversing a Document Section 15.6 Finding Elements in a Document Section 15.7 Modifying a Document Section 15.8 Adding Content to a Document Section 15.9 Example: A Dynamically Created Table of Contents This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 15.10 Querying Selected Text Section 15.11 The IE DOM Chapter 16 Cascading Style Sheets and Dynamic HTML Section 16.1 Overview of CSS Section 16.2 CSS for DHTML Section 16.3 Scripting Inline Styles Section 16.4 Scripting Computed Styles Section 16.5 Scripting CSS Classes Section 16.6 Scripting Stylesheets Chapter 17 Events and Event Handling Section 17.1 Basic Event Handling Section 17.2 Advanced Event Handling with DOM Level Section 17.3 The Internet Explorer Event Model Section 17.4 Mouse Events Section 17.5 Key Events Section 17.6 The onload Event Section 17.7 Synthetic Events Chapter 18 Forms and Form Elements Section 18.1 The Form Object Section 18.2 Defining Form Elements Section 18.3 Scripting Form Elements Section 18.4 Form Verification Example Chapter 19 Cookies and Client-Side Persistence Section 19.1 An Overview of Cookies Section 19.2 Storing Cookies Section 19.3 Reading Cookies Section 19.4 Cookie Example Section 19.5 Cookie Alternatives Section 19.6 Persistent Data and Security Chapter 20 Scripting HTTP Section 20.1 Using XMLHttpRequest Section 20.2 XMLHttpRequest Examples and Utilities Section 20.3 Ajax and Dynamic Scripting Section 20.4 Scripting HTTP with Tags Chapter 21 JavaScript and XML Section 21.1 Obtaining XML Documents Section 21.2 Manipulating XML with the DOM API Section 21.3 Transforming XML with XSLT Section 21.4 Querying XML with XPath Section 21.5 Serializing XML Section 21.6 Expanding HTML Templates with XML Data Section 21.7 XML and Web Services Section 21.8 E4X: ECMAScript for XML Chapter 22 Scripted Client-Side Graphics Section 22.1 Scripting Images Section 22.2 Graphics with CSS Section 22.3 SVG: Scalable Vector Graphics Section 22.4 VML: Vector Markup Language Section 22.5 Graphics in a Section 22.6 Graphics with Flash Section 22.7 Graphics with Java Chapter 23 Scripting Java Applets and Flash Movies Section 23.1 Scripting Applets This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 23.1 Scripting Applets Section 23.2 Scripting the Java Plug-in Section 23.3 Scripting with Java Section 23.4 Scripting Flash Section 23.5 Scripting Flash Part III: Core JavaScript Reference Chapter 24 Core JavaScript Reference Section 24.1 Sample Entry: how to read these reference pages Section 24.2 arguments[ ]: an array of function arguments Section 24.3 Arguments: arguments and other properties of a function Section 24.4 Arguments.callee: the function that is currently running Section 24.5 Arguments.length: the number of arguments passed to a function Section 24.6 Array: built-in support for arrays Section 24.7 Array.concat( ): concatenate arrays Section 24.8 Array.join( ): concatenate array elements to form a string Section 24.9 Array.length: the size of an array Section 24.10 Array.pop( ): remove and return the last element of an array Section 24.11 Array.push( ): append elements to an array Section 24.12 Array.reverse( ): reverse the elements of an array Section 24.13 Array.shift( ): shift array elements down Section 24.14 Array.slice( ): return a portion of an array Section 24.15 Array.sort( ): sort the elements of an array Section 24.16 Array.splice( ): insert, remove, or replace array elements Section 24.17 Array.toLocaleString( ): convert an array to a localized string Section 24.18 Array.toString( ): convert an array to a string Section 24.19 Array.unshift( ): insert elements at the beginning of an array Section 24.20 Boolean: support for boolean values Section 24.21 Boolean.toString( ): convert a boolean value to a string Section 24.22 Boolean.valueOf( ): the boolean value of a Boolean object Section 24.23 Date: manipulate dates and times Section 24.24 Date.getDate( ): return the day-of-the-month field of a Date Section 24.25 Date.getDay( ): return the day-of-the-week field of a Date Section 24.26 Date.getFullYear( ): return the year field of a Date Section 24.27 Date.getHours( ): return the hours field of a Date Section 24.28 Date.getMilliseconds( ): return the milliseconds field of a Date Section 24.29 Date.getMinutes( ): return the minutes field of a Date Section 24.30 Date.getMonth( ): return the month field of a Date Section 24.31 Date.getSeconds( ): return the seconds field of a Date Section 24.32 Date.getTime( ): return a Date in milliseconds Section 24.33 Date.getTimezoneOffset( ): determine the offset from GMT Section 24.34 Date.getUTCDate( ): return the day-of-the-month field of a Date (universal time) Section 24.35 Date.getUTCDay( ): return the day-of-the-week field of a Date (universal time) Section 24.36 Date.getUTCFullYear( ): return the year field of a Date (universal time) Section 24.37 Date.getUTCHours( ): return the hours field of a Date (universal time) Section 24.38 Date.getUTCMilliseconds( ): return the milliseconds field of a Date (universal time) Section 24.39 Date.getUTCMinutes( ): return the minutes field of a Date (universal time) Section 24.40 Date.getUTCMonth( ): return the month-of-the-year field of a Date (universal time) Section 24.41 Date.getUTCSeconds( ): return the seconds field of a Date (universal time) Section 24.42 Date.getYear( ): return the year field of a Date Section 24.43 Date.parse( ): parse a date/time string Section 24.44 Date.setDate( ): set the day-of-the-month field of a Date Section 24.45 Date.setFullYear( ): set the year and, optionally, the month and date fields of a Date Section 24.46 Date.setHours( ): set the hours, minutes, seconds, and milliseconds fields of a Date This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 24.47 Date.setMilliseconds( ): set the milliseconds field of a Date Section 24.48 Date.setMinutes( ): set the minutes, seconds, and milliseconds fields of a Date Section 24.49 Date.setMonth( ): set the month and day fields of a Date Section 24.50 Date.setSeconds( ): set the seconds and milliseconds fields of a Date Section 24.51 Date.setTime( ): set a Date in milliseconds Section 24.52 Date.setUTCDate( ): set the day-of-the-month field of a Date (universal time) Section 24.53 Date.setUTCFullYear( ): set the year, month, and day fields of a Date (universal time) Section 24.54 Date.setUTCHours( ): set the hours, minutes, seconds, and milliseconds fields of a Date (universal time) Section 24.55 Date.setUTCMilliseconds( ): set the milliseconds field of a Date (universal time) Section 24.56 Date.setUTCMinutes( ): set the minutes, seconds, and milliseconds fields of a Date (universal time) Section 24.57 Date.setUTCMonth( ): set the month and day fields of a Date (universal time) Section 24.58 Date.setUTCSeconds( ): set the seconds and milliseconds fields of a Date (universal time) Section 24.59 Date.setYear( ): set the year field of a Date Section 24.60 Date.toDateString( ): return the date portion of a Date as a string Section 24.61 Date.toGMTString( ): convert a Date to a universal time string Section 24.62 Date.toLocaleDateString( ): return the date portion of a Date as a locally formatted string Section 24.63 Date.toLocaleString( ): convert a Date to a locally formatted string Section 24.64 Date.toLocaleTimeString( ): return the time portion of a Date as a locally formatted string Section 24.65 Date.toString( ): convert a Date to a string Section 24.66 Date.toTimeString( ): return the time portion of a Date as a string Section 24.67 Date.toUTCString( ): convert a Date to a string (universal time) Section 24.68 Date.UTC( ): convert a Date specification to milliseconds Section 24.69 Date.valueOf( ): convert a Date to millisecond representation Section 24.70 decodeURI( ): unescape characters in a URI Section 24.71 decodeURIComponent( ): unescape characters in a URI component Section 24.72 encodeURI( ): escape characters in a URI Section 24.73 encodeURIComponent( ): escape characters in a URI component Section 24.74 Error: a generic exception Section 24.75 Error.message: a human-readable error message Section 24.76 Error.name: the type of an error Section 24.77 Error.toString( ): convert an Error object to a string Section 24.78 escape( ): encode a string Section 24.79 eval( ): execute JavaScript code from a string Section 24.80 EvalError: thrown when eval( ) is used improperly Section 24.81 Function: a JavaScript function Section 24.82 Function.apply( ): invoke a function as a method of an object Section 24.83 Function.arguments[]: arguments passed to a function Section 24.84 Function.call( ): invoke a function as a method of an object Section 24.85 Function.caller: the function that called this one Section 24.86 Function.length: the number of declared arguments Section 24.87 Function.prototype: the prototype for a class of objects Section 24.88 Function.toString( ): convert a function to a string Section 24.89 getClass( ): return the JavaClass of a JavaObject Section 24.90 Global: the global object Section 24.91 Infinity: a numeric property that represents infinity Section 24.92 isFinite( ): determine whether a number is finite Section 24.93 isNaN( ): check for not-a-number Section 24.94 java: the JavaPackage for the java.* package hierarchy Section 24.95 JavaArray: JavaScript representation of a Java array Section 24.96 JavaClass: JavaScript representation of a Java class Section 24.97 JavaObject: JavaScript representation of a Java object This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 24.98 JavaPackage: JavaScript representation of a Java package Section 24.99 JSObject: see JSObject in Part IV Section 24.100 Math: mathematical functions and constants Section 24.101 Math.abs( ): compute an absolute value Section 24.102 Math.acos( ): compute an arccosine Section 24.103 Math.asin( ): compute an arcsine Section 24.104 Math.atan( ): compute an arctangent Section 24.105 Math.atan2( ): compute the angle from the X axis to a point Section 24.106 Math.ceil( ): round a number up Section 24.107 Math.cos( ): compute a cosine Section 24.108 Math.E: the mathematical constant e Section 24.109 Math.exp( ): compute ex Section 24.110 Math.floor( ): round a number down Section 24.111 Math.LN10: the mathematical constant loge2 Section 24.112 Math.LN2: the mathematical constant loge10 Section 24.113 Math.log( ): compute a natural logarithm Section 24.114 Math.LOG10E: the mathematical constant log2e Section 24.115 Math.LOG2E: the mathematical constant log10e Section 24.116 Math.max( ): return the largest argument Section 24.117 Math.min( ): return the smallest argument Section 24.118 Math.PI: the mathematical constant π Section 24.119 Math.pow( ): compute xy Section 24.120 Math.random( ): return a pseudorandom number Section 24.121 Math.round( ): round to the nearest integer Section 24.122 Math.sin( ): compute a sine Section 24.123 Math.sqrt( ): compute a square root Section 24.124 Math.SQRT1_2: the mathematical constant 1/ Section 24.125 Math.SQRT2: the mathematical constant Section 24.126 Math.tan( ): compute a tangent Section 24.127 NaN: the not-a-number property Section 24.128 Number: support for numbers Section 24.129 Number.MAX_VALUE: the maximum numeric value Section 24.130 Number.MIN_VALUE: the minimum numeric value Section 24.131 Number.NaN: the special not-a-number value Section 24.132 Number.NEGATIVE_INFINITY: negative infinity Section 24.133 Number.POSITIVE_INFINITY: infinity Section 24.134 Number.toExponential( ): format a number using exponential notation Section 24.135 Number.toFixed( ): format a number using fixed-point notation Section 24.136 Number.toLocaleString( ): convert a number to a locally formatted string Section 24.137 Number.toPrecision( ): format the significant digits of a number Section 24.138 Number.toString( ): convert a number to a string Section 24.139 Number.valueOf( ): return the primitive number value Section 24.140 Object: a superclass that contains features of all JavaScript objects Section 24.141 Object.constructor: an object's constructor function Section 24.142 Object.hasOwnProperty( ): check whether a property is inherited Section 24.143 Object.isPrototypeOf( ): is one object the prototype of another? Section 24.144 Object.propertyIsEnumerable( ): will property be seen by a for/in loop? Section 24.145 Object.toLocaleString( ): return an object's localized string representation Section 24.146 Object.toString( ): define an object's string representation Section 24.147 Object.valueOf( ): the primitive value of the specified object Section 24.148 Packages: the root JavaPackage Section 24.149 parseFloat( ): convert a string to a number Section 24.150 parseInt( ): convert a string to an integer This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 24.150 parseInt( ): convert a string to an integer Section 24.151 RangeError: thrown when a number is out of its legal range Section 24.152 ReferenceError: thrown when reading a variable that does not exist Section 24.153 RegExp: regular expressions for pattern matching Section 24.154 RegExp.exec( ): general-purpose pattern matching Section 24.155 RegExp.global: whether a regular expression matches globally Section 24.156 RegExp.ignoreCase: whether a regular expression is case-insensitive Section 24.157 RegExp.lastIndex: the starting position of the next match Section 24.158 RegExp.source: the text of the regular expression Section 24.159 RegExp.test( ): test whether a string matches a pattern Section 24.160 RegExp.toString( ): convert a regular expression to a string Section 24.161 String: support for strings Section 24.162 String.charAt( ): get the nth character from a string Section 24.163 String.charCodeAt( ): get the nth character code from a string Section 24.164 String.concat( ): concatenate strings Section 24.165 String.fromCharCode( ): create a string from character encodings Section 24.166 String.indexOf( ): search a string Section 24.167 String.lastIndexOf( ): search a string backward Section 24.168 String.length: the length of a string Section 24.169 String.localeCompare( ): compare one string to another, using locale-specific ordering Section 24.170 String.match( ): find one or more regular-expression matches Section 24.171 String.replace( ): replace substring(s) matching a regular expression Section 24.172 String.search( ): search for a regular expression Section 24.173 String.slice( ): extract a substring Section 24.174 String.split( ): break a string into an array of strings Section 24.175 String.substr( ): extract a substring Section 24.176 String.substring( ): return a substring of a string Section 24.177 String.toLocaleLowerCase( ): convert a string to lowercase Section 24.178 String.toLocaleUpperCase( ): convert a string to uppercase Section 24.179 String.toLowerCase( ): convert a string to lowercase Section 24.180 String.toString( ): return the string Section 24.181 String.toUpperCase( ): convert a string to uppercase Section 24.182 String.valueOf( ): return the string Section 24.183 SyntaxError: thrown to signal a syntax error Section 24.184 TypeError: thrown when a value is of the wrong type Section 24.185 undefined: the undefined value Section 24.186 unescape( ): decode an escaped string Section 24.187 URIError: thrown by URI encoding and decoding methods Part IV: Client-Side JavaScript Reference Chapter 25 Client-Side JavaScript Reference Section 25.1 Anchor: the target of a hypertext link Section 25.2 Anchor.focus( ): scroll to make the anchor location visible Section 25.3 Applet: an applet embedded in a web page Section 25.4 Attr: an attribute of a document element Section 25.5 Button: see Input Section 25.6 Canvas: an HTML element for scripted drawing Section 25.7 Canvas.getContext( ): return a context for drawing on the canvas Section 25.8 CanvasGradient: a color gradient for use in a canvas Section 25.9 CanvasGradient.addColorStop( ): add a change of color at some point in the gradient Section 25.10 CanvasPattern: an image-based pattern for use in a Canvas Section 25.11 CanvasRenderingContext2D: the object used for drawing on a canvas Section 25.12 CanvasRenderingContext2D.arc( ): add an arc to the current subpath of a canvas, using a center point and radius This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 25.164 Section 25.165 Section 25.166 Section 25.167 Section 25.168 Section 25.169 Section 25.170 Section 25.171 Section 25.172 Section 25.173 Section 25.174 Section 25.175 Section 25.176 Section 25.177 Section 25.178 Section 25.179 Section 25.180 Section 25.181 Section 25.182 Section 25.183 Section 25.184 Section 25.185 Section 25.186 Section 25.187 Section 25.188 Section 25.189 Section 25.190 Section 25.191 Section 25.192 Section 25.193 Section 25.194 Section 25.195 Section 25.196 Section 25.197 Section 25.198 Section 25.199 Section 25.200 Section 25.201 Section 25.202 Section 25.203 Section 25.204 Section 25.205 Section 25.206 Section 25.207 Section 25.208 Section 25.209 Section 25.210 Section 25.211 Section 25.212 Section 25.213 Section 25.214 Section 25.215 Section 25.216 HTMLElement.onmouseout: event handler invoked when mouse moves out of an element HTMLElement.onmouseover: event handler invoked when the mouse moves over an element HTMLElement.onmouseup: event handler invoked when the user releases a mouse button HTMLElement.scrollIntoView( ): make an element visible IFrame: an in an HTML document Image: an image in an HTML document Image.onabort: event handler invoked when the user aborts image loading Image.onerror: event handler invoked when an error occurs during image loading Image.onload: event handler invoked when an image finishes loading Input: an input element in an HTML form Input.blur( ): remove keyboard focus from a form element Input.click( ): simulate a mouse click on a form element Input.focus( ): give keyboard focus to a form element Input.onblur: the handler invoked when a form element loses focus Input.onchange: event handler invoked when a form element's value changes Input.onclick: event handler invoked when a form element is clicked Input.onfocus: event handler invoked when a form element gains focus Input.select( ): select the text in a form element JavaArray, JavaClass, JavaObject, JavaPackage: see Part III JSObject: Java representation of a JavaScript object JSObject.call( ): invoke a method of a JavaScript object JSObject.eval( ): evaluate a string of JavaScript code JSObject.getMember( ): read a property of a JavaScript object JSObject.getSlot( ): read an array element of a JavaScript object JSObject.getWindow( ): return initial JSObject for browser window JSObject.removeMember( ): delete a property of a JavaScript object JSObject.setMember( ): set a property of a JavaScript object JSObject.setSlot( ): set an array element of a JavaScript object JSObject.toString( ): return the string value of a JavaScript object KeyEvent: details about a keyboard event Layer: an obsolete Netscape API Link: a hyperlink or anchor in an HTML document Link.blur( ): take keyboard focus away from a hyperlink Link.focus( ): make a link visible and give it keyboard focus Link.onclick: event handler invoked when a Link is clicked Link.onmouseout: event handler invoked when the mouse leaves a link Link.onmouseover: event handler invoked when the mouse goes over a link Location: represents and controls browser location Location.reload( ): reload the current document Location.replace( ): replace one displayed document with another MimeType: represents a MIME datatype MouseEvent: details about a mouse event MouseEvent.initMouseEvent( ): initialize the properties of a MouseEvent object Navigator: information about the browser in use Navigator.javaEnabled( ): test whether Java is available Node: a node in a document tree Node.appendChild( ): insert a node as the last child of this node Node.cloneNode( ): duplicate a node and, optionally, all of its descendants Node.hasAttributes( ): determine whether a node has attributes Node.hasChildNodes( ): determine whether a node has children Node.insertBefore( ): insert a node into the document tree before the specified node Node.isSupported( ): determine if a node supports a feature Node.normalize( ): merge adjacent Text nodes and remove empty ones This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 25.217 Section 25.218 Section 25.219 Section 25.220 Section 25.221 Section 25.222 Section 25.223 Section 25.224 Section 25.225 Section 25.226 Section 25.227 Section 25.228 Section 25.229 Section 25.230 Section 25.231 Section 25.232 Section 25.233 Section 25.234 Section 25.235 Section 25.236 Section 25.237 Section 25.238 Section 25.239 Section 25.240 Section 25.241 Section 25.242 Section 25.243 Section 25.244 Section 25.245 Section 25.246 Section 25.247 Section 25.248 Section 25.249 Section 25.250 Section 25.251 Section 25.252 Section 25.253 Section 25.254 Section 25.255 Section 25.256 Section 25.257 Section 25.258 Section 25.259 Section 25.260 Section 25.261 Section 25.262 Section 25.263 Section 25.264 Section 25.265 Section 25.266 Section 25.267 Section 25.268 Section 25.269 Node.removeChild( ): remove (and return) the specified child of this node Node.replaceChild( ): replace a child node with a new node Node.selectNodes( ): select nodes with an XPath query Node.transformNode( ): transform a node to a string using XSLT Node.transformNodeToObject( ): transform a node to a document using XSLT NodeList: a read-only array of nodes NodeList.item(): get an element of a NodeList Option: an option in a Select element Packages: see Packages in Part III Password: see Input Plugin: describes an installed plug-in ProcessingInstruction : a processing instruction in an XML document Radio: see Input Range: represents a contiguous range of a document Range.cloneContents(): copy range contents into a DocumentFragment Range.cloneRange(): make a copy of this range Range.collapse(): make one boundary point equal to the other Range.compareBoundaryPoints(): compare positions of two ranges Range.deleteContents(): delete a region of the document Range.detach(): free a Range object Range.extractContents( ): delete document content and return it in a DocumentFragment Range.insertNode( ): insert a node at the start of a range Range.selectNode(): set range boundaries to a node Range.selectNodeContents( ): set range boundaries to the children of a node Range.setEnd( ): set the end point of a range Range.setEndAfter( ): end a range after a specified node Range.setEndBefore( ): end a range before the specified node Range.setStart( ): set the start point of a range Range.setStartAfter( ): start a range after the specified node Range.setStartBefore( ): start a range before the specified node Range.surroundContents( ): surround range contents with the specified node Range.toString( ): get range contents as a plain-text string RangeException: signals a range-specific exception Reset: see Input Screen: provides information about the display Synopsis Select: a graphical selection list Select.add( ): insert an element Select.blur( ): take keyboard focus away from this element Select.focus( ): give keyboard focus to this element Select.onchange: event handler invoked when the selection changes Select.options[]: the choices in a Select object Select.remove( ): remove an Style: see CSS2Properties Submit: see Input Table: a in an HTML document Table.createCaption( ): get or create a Table.createTFoot( ): get or create a Table.createTHead( ): get or create a Table.deleteCaption( ): delete the of a table Table.deleteRow( ): delete a row of a table Table.deleteTFoot( ): delete the of a table Table.deleteTHead( ): delete the of a table This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 25.269 Section 25.270 Section 25.271 Section 25.272 Section 25.273 Section 25.274 Section 25.275 Section 25.276 Section 25.277 Section 25.278 Section 25.279 Section 25.280 Section 25.281 Section 25.282 Section 25.283 Section 25.284 Section 25.285 Section 25.286 Section 25.287 Section 25.288 Section 25.289 Section 25.290 Section 25.291 Section 25.292 Section 25.293 Section 25.294 Section 25.295 Section 25.296 Section 25.297 Section 25.298 Section 25.299 Section 25.300 Section 25.301 Section 25.302 Section 25.303 Section 25.304 Section 25.305 Section 25.306 Section 25.307 Section 25.308 Section 25.309 Section 25.310 Section 25.311 Section 25.312 Section 25.313 Section 25.314 Section 25.315 Section 25.316 Section 25.317 Section 25.318 Section 25.319 Section 25.320 Section 25.321 Table.deleteTHead( ): delete the of a table Table.insertRow( ): add a new, empty row to the table TableCell: cell in an HTML table TableRow: a element in an HTML table TableRow.deleteCell( ): delete a cell in a table row TableRow.insertCell( ): insert a new, empty element into a table row TableSection: a header, footer, or body section of a table TableSection.deleteRow( ): delete a row within a table section TableSection.insertRow( ): insert a new, empty row into this table section Text: a run of text in an HTML or XML document Text.splitText( ): split a Text node in two Textarea: a multiline text input area Textarea.blur( ): take keyboard focus away from this element Textarea.focus( ): give keyboard focus to this element Textarea.onchange: event handler invoked when input value changes Textarea.select( ): select the text in this element TextField: see Input UIEvent: details about user-interface events UIEvent.initUIEvent( ): initialize the properties of a UIEvent object Window: a web browser window or frame Window.addEventListener( ): see Element.addEventListener( ) Window.alert( ): display a message in a dialog box Window.attachEvent( ): see Element.attachEvent( ) Window.blur( ): remove keyboard focus from a top-level window Window.clearInterval( ): stop periodically executing code Window.clearTimeout( ): cancel deferred execution Window.close( ): close a browser window Window.confirm( ): ask a yes-or-no question Window.defaultStatus: the default status line text Window.detachEvent( ): see Element.detachEvent( ) Window.focus( ): give keyboard focus to a window Window.getComputedStyle( ): retrieve the CSS styles used to render an element Window.moveBy( ): move a window to a relative position Window.moveTo( ): move a window to an absolute position Window.onblur: event handler invoked when the window loses keyboard focus Window.onerror: error handler invoked when a JavaScript error occurs Window.onfocus: event handler invoked when a window is given focus Window.onload: event handler invoked when a document finishes loading Window.onresize: event handler invoked when a window is resized Window.onunload: the handler invoked when the browser leaves a page Window.open( ): open a new browser window or locate a named window Window.print( ): print the document Window.prompt( ): get user input with a dialog box Window.removeEventListener( ): see Element.removeEventListener( ) Window.resizeBy( ): resize a window by a relative amount Window.resizeTo( ): resize a window Window.scrollBy( ): scroll the document by a relative amount Window.scrollTo( ): scroll the document Window.setInterval( ): periodically execute specified code Window.setTimeout( ): defer execution of code Window.status: specify a transient status-line message XMLHttpRequest: An HTTP request and response XMLHttpRequest.abort( ): cancel an HTTP request This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 25.322 XMLHttpRequest.getAllResponseHeaders( ): return unparsed HTTP response headers Section 25.323 XMLHttpRequest.getResponseHeader( ): get the value of a named HTTP response header Section 25.324 XMLHttpRequest.onreadystatechange: event handler function invoked when readyState changes Section 25.325 XMLHttpRequest.open( ): initialize HTTP request parameters Section 25.326 XMLHttpRequest.send( ): send an HTTP request Section 25.327 XMLHttpRequest.setRequestHeader( ): add a HTTP request header to the request Section 25.328 XMLSerializer: serializes XML documents and nodes Section 25.329 XMLSerializer.serializeToString( ): convert an XML document or node to a string Section 25.330 XPathExpression: a compiled XPath query Section 25.331 XPathExpression.evaluate( ): evaluate a compiled XPath query Section 25.332 XPathResult: the result of an XPath query Section 25.333 XPathResult.iterateNext( ): return the next node that matches an XPath query Section 25.334 XPathResult.snapshotItem( ): return a node that matches an XPath query Section 25.335 XSLTProcessor: transform XML with XSLT stylesheets Section 25.336 XSLTProcessor.clearParameters( ): delete all stylesheet parameter values Section 25.337 XSLTProcessor.getParameter( ): return the value of a named parameter Section 25.338 XSLTProcessor.importStylesheet( ): specify an XSLT stylesheet for transformations Section 25.339 XSLTProcessor.removeParameter( ): delete a parameter value Section 25.340 XSLTProcessor.reset( ): restore an XSLTProcessor to its default state Section 25.341 XSLTProcessor.setParameter( ): set a stylesheet parameter Section 25.342 XSLTProcessor.transformToDocument( ): transform a node or document to a new document Section 25.343 XSLTProcessor.transformToFragment( ): transform a node or document to a DocumentFragment About the Author Colophon Index This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] UIEvent interface 2nd 3rd 4th initUIEvent( ) method unary operators 2nd associativity new typeof void unassigned vs undefined variables unbind( ) method undeclared variables undefined datatype 2nd identity comparisons undefined elements in array literals undefined property undefined values conversion to Java generating with void operator properties unassigned vs _ (underscore) in function names in identifiers prefixing private symbols unescape( ) function 2nd Unicode in identifiers in string literals keypress events represented as hexadecimal, escape sequences whitespace characters, matching in regular expressions unit values, specifying for style properties universal (UTC) time 2nd 3rd Date object methods for difference from local time unnamed functions, embedding in programs as literal data values unobtrusive JavaScript 2nd DOM Scripting Task Force, JavaScript Manifesto image rollovers unshift( ) method (Array) untyped languages updating loop variables URIError object URL property Document object HTMLDocument object URLs Ajax applications and assigning to location property currently displayed document This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com currently displayed document JavaScript in 2nd bookmarks embedding JavaScript in HTML execution of scripts Location object and XMLHttpRequest object and useMap property user scripting userAgent property (Navigator) 2nd userData persistence behavior sharing persistent data storage limits storing hierarchical data This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] validation, adding to HTML forms value property 2nd button element checkbox element file element FileUpload object, security restrictions on form elements Hidden element Option object radio element text element Textarea object valueOf( ) method 2nd 3rd Date object Object class objects, converting to numbers values data values in arrays function literals, embedding in programs functions as manipulating data values by null property, in object literals var statement 2nd varargs functions variable arity functions variable name resolution 2nd variable-length arguments list (Arguments object) variables as object properties execution contexts global object local variables (call object) case-sensitivity counter declaring 2nd garbage collection global identifiers in for/in loops initializing, with statements and JavaClass names local loop, initializing, testing, and updating null values in persistent and private scope 2nd global variables local variables This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com local variables no block scope undefined vs unassigned with statement and sharing among multiple frames and windows typing unassigned vs undefined undefined values variadic functions VBScript communication with JavaScript specifying as scripting language for web browser vector-graphics technologies Flash Java SVG VML versions browser 2nd CSS stylesheets JavaScript | (vertical bar) alternation in regular expressions 2nd bitwise OR operator 2nd |= (assignment) operator 2nd || (logical OR) operator 2nd || options in CSS view property (UIEvent) 2nd visibility cookies windows visibility attributes 2nd overflow and clip Visual Basic Scripting Edition VML (Vector Markup Language) 2nd drawing pie chart with JavaScript void operator 2nd 3rd explicitly specifying undefined return value This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] W3C standard API for determining computed style of HTML element XPath API W3C DOM 2nd 3rd 4th 5th browser support of HTML API language-independent interfaces levels and features representing documents as trees test suite for DOM modules watch( ) method web applications, single-page web browsers 2nd browsing history client-side compatibility browser testing conditional comments in IE feature-testing browsers history of incompatibility modern browsers online browser information client-side JavaScript cookies, storage limitations CSS versions, support for default actions associated with events preventing DOM conformance web sites for DOM implementation feature testing embedding JavaScript code in HTML tag tag tag defer attribute external scripts hiding scripts from old browsers nonstandard script attributes specifying scripting language event handlers in HTML execution of JavaScript programs event handlers and JavaScript URLs manipulating document while loading onload event handler onunload event handler threading model JavaScript embedded in JavaScript in URLs bookmarks This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com bookmarks JavaScript security cross-site scripting denial-of-service attacks restricted features in JavaScript same-origin policy scripting plug-ins and ActiveX controls unsupported features in JavaScript JavaScript, accessibility and programming environment event-driven model object hierarchy and DOM window as global execution context scripting windows dialog boxes error handling information on window, screen, or browser location and history multiple windows and frames navigation bar in a frame opening and manipulating windows status line timers styling XML using either CSS or XSL stylesheets XMLHttpRequest object, readyState web pages, cookies associated with web servers cookie storage limitations JavaScript interpreter security restrictions, relaxing within domain web services querying with SOAP web sites examples from this book Mozilla, open-source JavaScript interpreter web-related JavaScript embeddings WHATWG (browser vendor consortium) while statements continue statements in whitespace in JavaScript indentation of code newlines, escape squences in string literals regular expression metacharacters for width attribute 2nd width property Image object reference to, stored in an array Screen object window coordinates Window object 2nd 3rd as execution context back( ) and forward( ) methods clearInterval( ) method clearTimeout( ) method 2nd close( ) method closed property defaultStatus property document property event handlers This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com event handlers event property features frames[ ] array geometry methods geometry properties getComputedStyle( ) method getSelection( ) method history property JavaScript in interacting windows keyboard focus and visibility Location object location property methods and programming techniques (example) methods displaying dialog boxes methods, listed navigator property onerror property open( ) method 2nd 3rd undefined return value use by listanchors( ) function opener property properties screen property 2nd scrolling methods security restrictions on closing setInterval( ) method 2nd 3rd 4th setTimeout( ) method 2nd 3rd status property window property (Window) 2nd 3rd windows displaying with CSS interaction of JavaScript code among overlapping translucent windows (example) same-origin policy, document.domain property scripting browser windows dialog boxes error handling information on window, screen, or browser location and history multiple windows and frames navigation bar in a frame opening and manipulating windows status line timers Windows operating systems, scriptable ActiveX controls Windows Scripting Host, use of JScript interpreter with statement 2nd word boundary (\b) character in regular expressions \b (word boundary assertion), regular expressions 2nd word boundary assertion (\b) word character, ASCII (\w) \w (word metacharacter) 2nd wrapper objects for primitive datatypes converting primitives to write( ) method Document object 2nd 3rd 4th 5th 6th multiple arguments onload event handlers and using with open( ) and close( ) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com using with open( ) and close( ) HTMLDocument interface writeln( ) method (Document) This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] X and Y coordinates, mouse pointer 2nd XHTML defer attribute, tag JavaScript code in CDATA section SVG graphics embedded in file XML CDATASection declaration E4X (ECMAScript for XML) expanding HTML templates manipulating with DOM API creating HTML table fro XML HTML DOM vs obtaining XML documents creating new document from data islands loading document from network parsing XML text querying with XPath response to HTTP request 2nd response to XMLHttpRequest object serializing SVG 2nd transforming with XSLT use by Ajax VML web services and tag, creating XML data island XML.Transformer class XMLDocument property XMLHttpRequest object 2nd abort( ) method creating examples and utilities GET utilities getting headers only HTML, XML, and JSON-encoded responses POST request timing out a request handling asynchronous response load( ) method methods obtaining synchronous response obtaining XML document from web server same-origin policy and security single-page web applications submitting a request using This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com using XMLHttpRequest( ) constructor XMLSerializer object 2nd XOR (^) operator XPath evaluating expressions examples getNode( ) and getNodes( ) utility functions W3C API XPathExpression object XPathResult object XSLT (XSL Transformations) XSLTProcessor object XSS (cross-site scripting) defending against, online resources XUL This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] z-index attribute, CSS ... Introduction to JavaScript Section 1.1 What Is JavaScript? Section 1.2 Versions of JavaScript Section 1.3 Client-Side JavaScript Section 1.4 JavaScript in Other Contexts Section 1.5 Exploring JavaScript... 24.94 java: the JavaPackage for the java. * package hierarchy Section 24.95 JavaArray: JavaScript representation of a Java array Section 24.96 JavaClass: JavaScript representation of a Java class... JavaScript, they usually mean client-side JavaScript This book documents client-side JavaScript, along with the core JavaScript language that client-side JavaScript incorporates Client-side JavaScript