1. Trang chủ
  2. » Công Nghệ Thông Tin

Java script and

552 58 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 552
Dung lượng 2,7 MB

Nội dung

This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] • • • • • • Table of Contents Index Reviews Examples Reader Reviews Errata JavaScript & DHTML Cookbook By Danny Goodman Publisher Pub Date ISBN Pages : O'Reilly : April 2003 : 0-596-00467-2 : 540 On numerous online forums for JavaScript and DHTML, the majority of questions begin with "How I ?" This new Cookbook provides the answers with a comprehensive collection of problems, solutions, and practical examples The book's recipes range from simple tasks, such as manipulating strings and validating dates in JavaScript, to entire libraries that demonstrate complex tasks, such as cross-browser positioning of HTML elements and sorting tables [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] • • • • • • Table of Contents Index Reviews Examples Reader Reviews Errata JavaScript & DHTML Cookbook By Danny Goodman Publisher Pub Date ISBN Pages : O'Reilly : April 2003 : 0-596-00467-2 : 540 Copyright Preface About You About the Recipes What's in This Book Browser Platforms Conventions Used in This Book Request for Comments Acknowledgments Chapter Strings Section 1.0 Introduction Section 1.1 Concatenating (Joining) Strings Section 1.2 Accessing Substrings Section 1.3 Changing String Case Section 1.4 Testing Equality of Two Strings Section 1.5 Testing String Containment Without Regular Expressions Section 1.6 Testing String Containment with Regular Expressions Section 1.7 Searching and Replacing Substrings Section 1.8 Using Special and Escaped Characters Section 1.9 Reading and Writing Strings for Cookies Section 1.10 Converting Between Unicode Values and String Characters Section 1.11 Encoding and Decoding URL Strings Section 1.12 Encoding and Decoding Base64 Strings This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 1.12 Encoding and Decoding Base64 Strings Chapter Numbers and Dates Section 2.0 Introduction Section 2.1 Converting Between Numbers and Strings Section 2.2 Testing a Number's Validity Section 2.3 Testing Numeric Equality Section 2.4 Rounding Floating-Point Numbers Section 2.5 Formatting Numbers for Text Display Section 2.6 Converting Between Decimal and Hexadecimal Numbers Section 2.7 Generating Pseudorandom Numbers Section 2.8 Calculating Trigonometric Functions Section 2.9 Creating a Date Object Section 2.10 Calculating a Previous or Future Date Section 2.11 Calculating the Number of Days Between Two Dates Section 2.12 Validating a Date Chapter Arrays and Objects Section 3.0 Introduction Section 3.1 Creating a Simple Array Section 3.2 Creating a Multidimensional Array Section 3.3 Converting Between Arrays and Strings Section 3.4 Doing Something with the Items in an Array Section 3.5 Sorting a Simple Array Section 3.6 Combining Arrays Section 3.7 Dividing Arrays Section 3.8 Creating a Custom Object Section 3.9 Simulating a Hash Table for Fast Array Lookup Section 3.10 Doing Something with a Property of an Object Section 3.11 Sorting an Array of Objects Section 3.12 Customizing an Object's Prototype Section 3.13 Converting Arrays and Custom Objects to Strings Chapter Variables, Functions, and Flow Control Section 4.0 Introduction Section 4.1 Creating a JavaScript Variable Section 4.2 Creating a Named Function Section 4.3 Nesting Named Functions Section 4.4 Creating an Anonymous Function Section 4.5 Delaying a Function Call Section 4.6 Branching Execution Based on Conditions Section 4.7 Handling Script Errors Gracefully Section 4.8 Improving Script Performance Chapter Browser Feature Detection Section 5.0 Introduction Section 5.1 Detecting the Browser Brand Section 5.2 Detecting an Early Browser Version Section 5.3 Detecting the Internet Explorer Version Section 5.4 Detecting the Netscape Navigator Version Section 5.5 Detecting the Client Operating System Section 5.6 Detecting Object Support Section 5.7 Detecting Object Property and Method Support Section 5.8 Detecting the Browser Written Language This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 5.9 Detecting Cookie Availability Section 5.10 Defining Browser- or Feature-Specific Links Section 5.11 Testing on Multiple Browser Versions Chapter Managing Browser Windows Section 6.0 Introduction Section 6.1 Setting the Main Window's Size Section 6.2 Positioning the Main Window Section 6.3 Maximizing the Main Window Section 6.4 Creating a New Window Section 6.5 Bringing a Window to the Front Section 6.6 Communicating with a New Window Section 6.7 Communicating Back to the Main Window Section 6.8 Using Internet Explorer Modal/Modeless Windows Section 6.9 Simulating a Cross-Browser Modal Dialog Window Section 6.10 Simulating a Window with Layers Chapter Managing Multiple Frames Section 7.0 Introduction Section 7.1 Creating a Blank Frame in a New Frameset Section 7.2 Changing the Content of One Frame from Another Section 7.3 Changing the Content of Multiple Frames at Once Section 7.4 Replacing a Frameset with a Single Page Section 7.5 Avoiding Being "Framed" by Another Site Section 7.6 Assuring a Page Loads in its Frameset Section 7.7 Reading a Frame's Dimensions Section 7.8 Resizing Frames Section 7.9 Setting Frameset Specifications Dynamically Chapter Dynamic Forms Section 8.0 Introduction Section 8.1 Auto-Focusing the First Text Field Section 8.2 Performing Common Text Field Validations Section 8.3 Preventing Form Submission upon Validation Failure Section 8.4 Auto-Focusing an Invalid Text Field Entry Section 8.5 Changing a Form's Action Section 8.6 Blocking Submissions from the Enter Key Section 8.7 Advancing Text Field Focus with the Enter Key Section 8.8 Submitting a Form by an Enter Key Press in Any Text Box Section 8.9 Disabling Form Controls Section 8.10 Hiding and Showing Form Controls Section 8.11 Allowing Only Numbers (or Letters) in a Text Box Section 8.12 Auto-Tabbing for Fixed-Length Text Boxes Section 8.13 Changing select Element Content Section 8.14 Copying Form Data Between Pages Chapter Managing Events Section 9.0 Introduction Section 9.1 Equalizing the IE and W3C Event Models Section 9.2 Initiating a Process After the Page Loads Section 9.3 Determining the Coordinates of a Click Event Section 9.4 Preventing an Event from Performing Its Default Behavior Section 9.5 Blocking Double Clicks This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 9.6 Determining Which Element Received an Event Section 9.7 Determining Which Mouse Button Was Pressed Section 9.8 Reading Which Character Key Was Typed Section 9.9 Reading Which Noncharacter Key Was Pressed Section 9.10 Determining Which Modifier Keys Were Pressed During an Event Section 9.11 Determining the Element the Cursor Rolled From/To Section 9.12 Synchronizing Sounds to Events Chapter 10 Page Navigation Techniques Section 10.0 Introduction Section 10.1 Loading a New Page or Anchor Section 10.2 Keeping a Page Out of the Browser History Section 10.3 Using a select Element for Navigation Section 10.4 Passing Data Between Pages Via Cookies Section 10.5 Passing Data Between Pages Via Frames Section 10.6 Passing Data Between Pages Via URLs Section 10.7 Creating a Contextual (Right-Click) Menu Section 10.8 Creating Drop-Down Navigation Menus Section 10.9 Providing Navigation Trail Menus Section 10.10 Creating Expandable Menus Section 10.11 Creating Collapsible XML Menus Chapter 11 Managing Style Sheets Section 11.0 Introduction Section 11.1 Assigning Style Sheet Rules to an Element Globally Section 11.2 Assigning Style Sheet Rules to a Subgroup of Elements Section 11.3 Assigning Style Sheet Rules to an Individual Element Section 11.4 Importing External Style Sheets Section 11.5 Importing Browser- or Operating System-Specific Style Sheets Section 11.6 Changing Imported Style Sheets After Loading Section 11.7 Enabling/Disabling Style Sheets Section 11.8 Toggling Between Style Sheets for an Element Section 11.9 Overriding a Style Sheet Rule Section 11.10 Turning Arbitrary Content into a Styled Element Section 11.11 Creating Center-Aligned Body Elements Section 11.12 Reading Effective Style Sheet Property Values Section 11.13 Forcing Version Browsers into Standards-Compatibility Mode Chapter 12 Visual Effects for Stationary Content Section 12.0 Introduction Section 12.1 Precaching Images Section 12.2 Swapping Images (Rollovers) Section 12.3 Changing Text Style Properties Section 12.4 Offering Body Text Size Choices to Users Section 12.5 Creating Custom Link Styles Section 12.6 Changing Page Background Colors and Images Section 12.7 Hiding and Showing Elements Section 12.8 Adjusting Element Transparency Section 12.9 Creating Transition Visual Effects Chapter 13 Positioning HTML Elements Section 13.0 Introduction Section 13.1 Making an Element Positionable in the Document Space This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Section 13.2 Connecting a Positioned Element to a Body Element Section 13.3 Controlling Positioning Via a DHTML JavaScript Library Section 13.4 Deciding Between div and span Containers Section 13.5 Adjusting Positioned Element Stacking Order (z-order) Section 13.6 Centering an Element on Top of Another Element Section 13.7 Centering an Element in a Window or Frame Section 13.8 Determining the Location of a Nonpositioned Element Section 13.9 Animating Straight-Line Element Paths Section 13.10 Animating Circular Element Paths Section 13.11 Creating a Draggable Element Section 13.12 Scrolling div Content Section 13.13 Creating a Custom Scrollbar Chapter 14 Creating Dynamic Content Section 14.0 Introduction Section 14.1 Writing Dynamic Content During Page Loading Section 14.2 Creating New Page Content Dynamically Section 14.3 Including External HTML Content Section 14.4 Embedding XML Data Section 14.5 Embedding Data as JavaScript Objects Section 14.6 Transforming XML Data into HTML Tables Section 14.7 Transforming JavaScript Objects into HTML Tables Section 14.8 Converting an XML Node Tree to JavaScript Objects Section 14.9 Creating a New Element Section 14.10 Creating Text Content for a New Element Section 14.11 Creating Mixed Element and Text Nodes Section 14.12 Inserting and Populating an iframe Element Section 14.13 Getting a Reference to an HTML Element Object Section 14.14 Replacing Portions of Body Content Section 14.15 Removing Body Content Section 14.16 Sorting Dynamic Tables Section 14.17 Walking the Document Node Tree Section 14.18 Capturing Document Content Chapter 15 Dynamic Content Applications Section 15.0 Introduction Section 15.1 Displaying a Random Aphorism Section 15.2 Converting a User Selection into an Arbitrary Element Section 15.3 Automating the Search-and-Replace of Body Content Section 15.4 Creating a Slide Show Section 15.5 Auto-Scrolling the Page Section 15.6 Greeting Users with Their Time of Day Section 15.7 Displaying the Number of Days Before Christmas Section 15.8 Displaying a Countdown Timer Section 15.9 Creating a Calendar Date Picker Section 15.10 Displaying an Animated Progress Bar Appendix A Keyboard Event Character Values Appendix B Keyboard Key Code Values Appendix C ECMAScript Reserved Keywords Colophon Index [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] Copyright © 2003 O'Reilly & Associates, Inc Printed in the United States of America Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O'Reilly & Associates books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://safari.oreilly.com) For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly & Associates, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Java , all Java-based trademarks and logos, and JavaScript are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries O'Reilly & Associates, Inc is independent of Sun Microsystems Where those designations appear in this book, and O'Reilly & Associates, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps The association between the image of a howler monkey and the topic of JavaScript and DHTML is a trademark of O'Reilly & Associates, Inc While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] Preface Several bookmarks in my primary web browser link to sites that have, for years, displayed the "under construction" message and yellow-and-black "men working" road sign symbol Ever the optimist, I keep the bookmarks alive and periodically visit the sites, looking forward to the day when the stick figure in the hard hat with the shovel leaves the scene, revealing a gleaming site containing the information that I had hoped for years ago This image comes to mind because my "brain browser" has maintained a bookmark to this book for years—but that stick figure kept hammering, sawing, and digging while the book remained forever "under construction." Even though client-side JavaScript has been around since late 1995, and true Dynamic HTML concepts have been within reach since 1998, the road has been a bumpy one for those trying to use (and write about) the technologies Conflicts in document object model (DOM) implementations in various browsers, complicated by the evolution of the World Wide Web Consortium's (W3C) DOM recommendation, have made deployment of insightful client-side applications occasionally treacherous This is especially true if the application must run on a broad range of browser brands and operating systems Now that the W3C DOM standard has fleshed itself out sufficiently, and other DHTML-related standards (HTML, XHTML, and Cascading Style Sheets) are largely working toward the same interoperable goals, it is finally time to apply the current state of the art to typical client-side scripting tasks A cookbook approach lends itself nicely to provide answers to the most common question leadin from programmers, designers, and content authors: "How I ?" [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] About You Client-side scripting and DHTML are such broad and deep subjects that virtually every reader coming to this book will have different experience levels, expectations, and perhaps, fears No book could hope to anticipate every possible question from someone wishing to use these technologies in their web pages Therefore, this book makes some assumptions about readers at various stages of their experience: You have at least rudimentary knowledge of client-side JavaScript concepts You know how to put scripts into a web page — where tags go as well as how to link an external js file into the current page You also know what variables, strings, numbers, Booleans, arrays, and objects are—even if you don't necessarily remember the precise way they're used with the JavaScript language This book is not a tutorial, but you can learn a lot from reading the introductions to each chapter and the discussions following each solution You may be a casual scripter, who wants to put a bit of intelligence into a web page for some project or other You don't use the language or object model every day, so you need a refresher about even some simple things, such as the correct syntax for creating an array or pre-loading images for fast image rollover effects While surfing the Web, you may have encountered some scripted DHTML effect that you'd like to implement or adapt for your own pages, but either you can't decipher the code you see or you want to "roll your own" version to avoid copyright problems with the code's original owner If the effect or technique you've seen is fairly popular, this cookbook probably has a recipe for it You can use these recipes as they are or modify them to fit your designs There are no royalties or copyrights to worry about, as long as you don't offer these recipes to others as part of a collection of scripts Of course, if you wish to acknowledge this book in your source code comments, that would be great! You may be an experienced web developer who has probed gingerly, if at all, into client-side scripting The horror stories of yore about browser incompatibilities have kept your focus entirely on server-side programming But now that so many mainstream sites are using clientside scripting to improve the user experience, you are ready to take another look at what is out there At the far end of the spectrum, you may be an experienced client-side DHTML developer in search of new ideas and techniques For instance, you may have developed exclusively for the Internet Explorer browser on the Windows platform, but you wish to gravitate toward standards-compatible syntax for future coding Virtually every reader will find that some recipes in this book are too simple and others are too complex for their experience level I hope the more difficult ones challenge you to learn more and improve your skills Even if you think you know it all, be sure to check the discussions of the easier recipes for tips and insights that may be new to you [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] About the Recipes It's helpful for a reader to know up front what biases an author has on the book's subject To carry the cookbook metaphor too far, just as a culinary chef has identifiable procedures and seasonings, so I format my code in a particular way and employ programming styles that I have adopted over the years More important than scripting style, however, are the implementation threads that weave their way throughout the code examples Because these examples may serve as models for your own development, they are written for maximum clarity to make it easy (I hope) for you to follow the execution logic Names assigned to variables, functions, objects, and the like are meant to convey their purpose within the context of the example One of the goals of coding is that the operation of a program should be self-evident to someone else reading the code, even if that "someone else" is the programmer who revisits the code six months later to fix a bug or add a feature There's no sense in being cryptically clever if no one can understand what you mean by assigning some value to a variable named x This book unabashedly favors the W3C DOM way of addressing document objects You can use this format to reference element objects in browsers starting with Microsoft Internet Explorer and Netscape 6, which means that the vast majority of browsers in use today support this standard Where IE does not support the standard (as in handling events), all recipes here include efficient cross-browser implementations You won't find too much in the way of IE-only solutions, especially if they would cover only the Windows version of IE At the same time, this book acknowledges that you may need to support users who not have W3C DOM-empowered browsers You will find that substantial attention is paid to making even advanced DHTML scripts coexist gracefully in an old or nonscriptable browser This is particularly important if you wish your pages to serve visitors with accessibility challenges (such as vision or physical impairments) or pocket computers containing underpowered browsers One credo dominates the recipes throughout this book: scripting must add value to static content on the page Don't look to this book for scripts that cycle background colors to nauseate visitors or make elements bounce around the page while singing Happy Birthday You may be able to figure out how those horrible things from what you learn in this book, but that's your business The examples here, while perhaps conservative, are intended to solve real-world problems that scripters and developers face in professional-quality applications The scripting techniques and syntax you see throughout this book are designed for maximum forward compatibility It's difficult to predict the future of any technology, but the W3C DOM and ECMAScript standards, as implemented in today's latest browsers, are the most stable platforms on which to build client-side applications since client-side scripting began With a bit of code added here and there to degrade gracefully in older browsers, your applications should be running fine well into the future [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] page navigation creating collapsible XML menus contextual (right-click) menus drop-down navigation menus expandable menus history, keeping pages out of loading a new page or anchor passing data between pages pop-up/drop-down navigation menus providing navigation trail menus inside a frameset select elements, using for pages changing background color and images data, passing between via cookies via frames via URLs loading skins, enabling users to choose parent window reference parentheses ( ) and functions parseFloat( ) method 2nd 3rd browser version detection using parseInt( ) method 2nd 3rd hexadecimal to decimal conversion number base conversions performance (scripts), improving performing common text field validations Play( ) command (IE) play( ) method pop( ) method pop-ups blocking ads creating calendars pop-up or pop-under windows pop-up/drop-down navigation menus populateTable( ) function positioning HTML elements adjusting stacking order (z-order) animating circular paths centering in windows or frames centering one on top of another controlling via DHBMLAPI.js div vs span containers evolving contexts 2nd in document space and older browsers 2nd positioning types recentering scope 2nd units of measure 2nd positioning types positionMenu( ) function POST method and location.replace( ) method precaching of images monitoring prev( ) function preventing an event from performing its default behavior properties This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com testing for property names hyphens and prototype property providing navigation trail menus push( ) method pushUndoNew( ) function [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] quoting strings [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] random number generation rangeObject.getBookmark( ) method rangeObject.moveToBookmark( ) rangeReplace.js library readData( ) function reading a frames's dimensions effective style sheet property values strings from cookies which character key was typed which mouse button was clicked which noncharacter key was pressed real-time form validation referencing element objects elements from events regular expressions 2nd modifier characters (g, i, gi) notation testing strings for containment of substrings usage for text field validation (forms) relatedTarget property (W3C DOM) relative positioning relative URLs remove( ) function removeChild( ) method removing body content replace( ) method 2nd 3rd replaceChild( ) method 2nd replacing a frameset with a single page requestHide( ) function 2nd reserved keywords resetTimer( ) function resizeBy( ) method resizeLeft( ) function resizeTo( ) method resizing frames restoreFrame( ) function rounding floating-point numbers runProgressBar( ) function runSpecial( ) function [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] Safari browser same origin security policy screen object properties screenX/screenY properties tags, src attribute scrollBar( ) constructor function 2nd scrollbars and frame size measurement creating scrollBars.js library scrollButtons.js library scrollBy( ) function scrollBy( ) method scrolling auto-scrolling pages region and controller scrolling div content scrollWindow( ) function searching and replacing of body content, automating substrings security frames same origin policy seekLayer( ) function select element add( ) and remove( ) methods changing options using for page navigation select( ) method 2nd selectedObj global variable selection2Element( ) event handler function self window reference server configuration and image rollovers server process URLs session IDs setAttribute( ) method setbgImage( ) function setCities( ) function W3C DOM version setContextTitles( ) function setCookie( ) function setCurrMonth( ) function setImage( ) function setImages( ) function setInterval( ) method 2nd 3rd 4th animation and vs setTimout( ) method setLinkTargets( ) function setSelectedElem( ) function 2nd setSelectedElement( ) function setSizeStyle( ) function setTimeout( ) method 2nd 3rd 4th 5th 6th animation and setting frameset specifications dynamically main window size (browsers) setZIndex( ) function 2nd Shift keys shift( ) method shiftBy( ) function This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com shiftTo( ) function shiftTo( ) functionn show( ) function showCalendar( ) function 2nd showContextMenu( ) function showMenu( ) function 2nd showModalDialog( ) method properties showModelessDialog( ) method properties showProgressBar( ) function signed scripts simModal.js library simulating a hash table for fast array lookup enhancing script efficiency via cross-browser modal dialog windows windows with layers single quote (') skins slice( ) method 2nd slide shows, creating automatic cycling through slides HTML page sort( ) method 2nd sorting an array of objects dynamic tables simple arrays sortTable( ) function source code, hiding from view span element 2nd 3rd vs div special characters using splice( ) method split( ) method square brackets ([ ]) srBatch( ) function srcElement property (IE) srQuery( ) function stacking rules standards-compatible mode stopPropagation( ) method strict equality operators (= = =) 2nd string variables, changing case of stringForms.js library strings Base64, encoding and decoding changing string case concatenating converting to arrays from arrays and custom objects between numbers and between Unicode values and creating escape sequences quoting searching and replacing substrings substrings, accessing testing containment of one by another with regular expressions containment of one by another without regular expressions string pairs for equality URLs, encoding and decoding This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com values compared to objects stripCommas( ) function style attribute style property style sheets [See CSS] tag and older browsers style.display property style.MozOpacity property style.visibility visibility property submitForm( ) function substr( ) method substring( ) method substrings searching and replacing swap( ) function 2nd swapping images (rollovers) swapState( ) helper function 2nd switch synchronizing sounds to events system-generated actions [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] table element table event handlers, HTML for tables modification methods, W3C DOM sorting dynamic usage in context menus target property (W3C DOM) teamMember object testing equality of two strings for numeric equality number validity on multiple browser versions string containment with regular expressions withou regular expressions text offering users choice of body text size text box event handlers, HTML for text box values, performing math on text fields allowing only numbers or text validation date validation library preventing form submission on failure with regular expressions text range text style properties changing textarea elements, escape characters and TextRange object th element this keyword time of day greeting toElement property (IE) toFixed( ) method toggle( ) function 2nd toggleFrame( ) function toggleHighlight( ) function togglePurDec( ) function toLocaleString( ) method toLowerCase( ) method 2nd top keyword top window reference toPrecision( ) method toString( ) method toUpperCase( ) method trail.js library transforming JavaScript objects into HTML tables XML data into HTML tables transition filters (IE) backward-compatible types new style TreeWalker object trigonometric functions, calculating try/catch construction turning arbitrary content into a styled element typeof operators [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] U.S English keyboard and corresponding keycodes undoObject unescape( ) method Unicode conversion between string values and unshift( ) method updateThumb( ) function URLs (uniform resource locators) encoding and decoding passing data between pages, using for relative URLs server process URLs user-generated actions userAgent string, operating systems using Internet Explorer modal/modeless windows select elements for page navigation special and escaped characters UTC (Coordinated Universal Time) [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] validateForm( ) function validating a date var keyword defining variables inside functions variables case-sensitiivity creating global, setting naming rules and conventions scope strings, assigning to vendorSub property verifySupport( ) function 2nd Virtual PC (Connectix Corporation) visibility property visual effects for stationary content adjusting element transparency changing page background colors and images creating custom link styles transition visual effects hiding and showing elements images precaching swapping (rollovers) offering body text size choices to users referencing element objects elements from events text style properties, changing [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] W3C DOM standard 2nd 3rd table-modification methods walkChildNodes( ) function walking document node trees web pages data, embedding in design considerations multiple browsers, testing on web publishing, units of measure web sites accessibility and law window chrome window object frames methods moveBy( ) moveTo( ) resizeBy( ) resizeTo( ) onload event referencing of and referencing of element objects window reference window.navigate( ) method window.open( ) method 2nd subwindow references window.setTimeout( ) method window.showModalDialog( ) window.showModelessDialog( ) windows [See also browsers][See also browsers] abuse bringing windows to front centering elements in closing from subwindows cross-browser modal dialog window, simulating Internet Explorer modal/modeless windows limitations main windows, communicating back to managing maximizing new windows, communicating with new windows, creating positioning resizing main window secondary windows, cautions simulating windows with layers with construction and script efficiency word wrapping, JavaScript source code writing dynamic content during page loading strings to cookies [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] xDoc global variable XML collapsible menus, creating data, embedding node trees, converting to JavaScript objects XML\: OPML (Outline Processing Markup Language) XML2JS( ) function XMLoutline.js library [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] ynOnly( ) function [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] z-index values [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Brought to You by ... claimed as trademarks Java , all Java- based trademarks and logos, and JavaScript are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries O'Reilly... Data as JavaScript Objects Section 14.6 Transforming XML Data into HTML Tables Section 14.7 Transforming JavaScript Objects into HTML Tables Section 14.8 Converting an XML Node Tree to JavaScript... broad range of browser brands and operating systems Now that the W3C DOM standard has fleshed itself out sufficiently, and other DHTML-related standards (HTML, XHTML, and Cascading Style Sheets)

Ngày đăng: 26/03/2019, 11:23

w