Содержание
JavaScript & jQuery: The Missing Manual, 3rd Edition
Read it now on the O’Reilly learning platform with a 10-day free trial.
O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.
Book description
JavaScript lets you supercharge your HTML with animation, interactivity, and visual effects—but many web designers find the language hard to learn. This easy-to-read guide not only covers JavaScript basics, but also shows you how to save time and effort with the jQuery and jQuery UI libraries of prewritten JavaScript code. You’ll build web pages that feel and act like desktop programs—with little or no programming.
The important stuff you need to know:
- Pull back the curtain on JavaScript. Learn how to build a basic program with this language.
- Get up to speed on jQuery. Quickly assemble JavaScript programs that work well on multiple web browsers.
- Transform your user interface. Learn jQuery UI, the JavaScript library for interface features like design themes and controls.
- Make your pages interactive. Create JavaScript events that react to visitor actions.
- Use animations and effects. Build drop-down navigation menus, pop-ups, automated slideshows, and more.
- Collect data with web forms. Create easy-to-use forms that ensure more accurate visitor responses.
- Practice with living examples. Get step-by-step tutorials for web projects you can build yourself.
Publisher resources
Table of contents
- JavaScript & jQuery: The Missing Manual
- The Missing Credits
- About the Author
- About the Creative Team
- Acknowledgments
- The Missing Manual Series
- What Is JavaScript?
- A Bit of History
- JavaScript Is Everywhere
- How HTML Tags Work
- Anatomy of a Style
- Free Programs
- Commercial Software
- This Bookâs Approach to JavaScript
- About the Outline
- AboutâTheseâArrows
- Living Examples
- Registration
- Feedback
- Errata
- Safari® Books Online
- 1. Writing Your First JavaScript Program
- Introducing Programming
- Whatâs a Computer Program?
- External JavaScript Files
- The Chrome JavaScript Console
- The Internet Explorer Console
- The Firefox JavaScript Web Console
- The Safari Error Console
- Statements
- Built-In Functions
- Types of Data
- Numbers
- Strings
- Booleans
- Creating a Variable
- Using Variables
- Basic Math
- The Order of Operations
- Combining Strings
- Combining Numbers and Strings
- Changing the Values in Variables
- Creating an Array
- Accessing Items in an Array
- Adding Items to an Array
- Adding an Item to the End of an Array
- Adding an Item to the Beginning of an Array
- Choosing How to Add Items to an Array
- When to Use Comments
- Comments in This Book
- Making Programs React Intelligently
- Conditional Statement Basics
- Adding a Backup Plan
- Testing More Than One Condition
- More Complex Conditions
- Making Sure More than One Condition is True
- Making Sure at Least One Condition is True
- Negating a Condition
- While Loops
- Loops and Arrays
- For Loops
- Do/While Loops
- Mini-Tutorial
- Giving Information to Your Functions
- Retrieving Information from Functions
- Keeping Variables from Colliding
- 4. Introducing jQuery
- About JavaScript Libraries
- Getting jQuery
- Linking to the jQuery File on a CDN Server
- Downloading Your Own jQuery File
- Basic Selectors
- ID Selectors
- Element Selectors
- Class Selectors
- Automatic Loops
- Chaining Functions
- Replacing and Removing Selections
- Classes
- Reading and Changing CSS Properties
- Changing Multiple CSS Properties at Once
- Anonymous Functions
- this and $(this)
- Overview
- Programming
- What Are Events?
- Mouse Events
- Document/Window Events
- Form Events
- Keyboard Events
- Waiting for the HTML to Load
- An Alternative to $(Document).Ready()
- Other Ways to Use the on() Function
- Delegating Events with on()
- How Event Delegation Affects the $(this) Object
- Overview of the Task
- The Programming
- jQuery Effects
- Basic Showing and Hiding
- Fading Elements In and Out
- Sliding Elements
- The Programming
- Easing
- The Programming
- jQuery and CSS Transitions
- jQuery and CSS Animations
- Swapping Images
- Changing an Imageâs src Attribute
- Swapping Images with jQuery
- Preloading Images
- Rollover Images
- Overview of the Task
- The Programming
- Overview of the Gallery
- The Programming
- Selecting Links with JavaScript
- Determining a Linkâs Destination
- Donât Follow That Link
- Window Properties
- Use the Window Reference
- Events that Can Open a New Window
- What to Look for in a jQuery Plug-in
- jQuery Plug-in Basics
- The HTML
- The CSS
- The JavaScript
- The Tutorial
- Customizing the Look of the SmartMenus Plug-in
- Understanding Forms
- Selecting Form Elements
- Getting and Setting the Value of a Form Element
- Determining Whether Buttons and Boxes Are Checked
- Form Events
- Submit
- Focus
- Blur
- Click
- Change
- Focusing the First Field in a Form
- Disabling and Enabling Fields
- Hiding and Showing Form Options
- Focusing a Field
- Disabling Form Fields
- Hiding Form Fields
- jQuery Validation Plug-in
- Basic Validation
- Adding Validation Rules
- Adding Error Messages
- Advanced Rules
- Advanced Error Messages
- Basic Validation
- Advanced Validation
- Validating Checkboxes and Radio Buttons
- Formatting the Error Messages
- 9. Expanding Your Interface
- What Is jQuery UI?
- Why Use jQuery UI?
- Using jQuery UI
- Adding jQuery UI to a Web Page
- Mini-Tutorial: Creating a Dialog Box
- Setting Dialog Box Properties
- Mini Tutorial: Passing Options to the Dialog Widget
- Opening Dialog Boxes with Events
- Adding Buttons to a Dialog Box
- Mini-Tutorial: Adding Buttons to a Dialog Box
- Mini-Tutorial: Adding Tooltips Quickly
- Tooltip Options
- Using HTML Content in a Tooltip
- Mini-Tutorial: Add HTML to a Tooltip
- Tabbed Panel Options
- Mini-Tutorial: Add Tabbed Panels
- Tabs with Remote Panel Content
- Mini-Tutorial: Create a jQuery UI Accordion
- Creating a Horizontal Navigation Bar
- Picking Dates with Style
- Setting Date Picker Properties
- Tutorial: Adding a Birthdate Picker
- Setting Select Menu Properties
- Performing an Action When a Visitor Selects an Option
- Customizing Buttons
- Using Arrays for Autocomplete
- Using Separate Labels and Values
- Getting Autocomplete Data from the Server
- Autocomplete Options
- Introducing ThemeRoller
- Downloading and Using Your New Theme
- Adding a New Theme to an Existing Website
- More About the jQuery UI CSS Files
- Understanding Specificity
- How jQuery UI Styles Widgets
- The Draggable Widget
- Adding the Draggable Widget to a Web Page
- Draggable Mini-Tutorial
- Draggable Widget Options
- Draggable Widget Events
- The Create Event
- The Start Event
- The Drag Event
- The Stop Event
- Using the Droppable Widget
- Droppable Widget Options
- Droppable Widget Events
- The Drop Event
- The Activate Event
- The Deactivate Event
- The Over Event
- The Out Event
- Using the Sortable Widget
- Sortable Widget Options
- Sortable Events
- Sortable Methods
- The Effects
- Easing
- Animating Changes Between Classes
- 13. Introducing Ajax
- What Is Ajax?
- Ajax: The Basics
- Pieces of the Puzzle
- Talking to the Web Server
- Using the load() Method
- Tutorial: The load() Function
- Overview
- The Programming
- Query String
- Object Literal
- Jqueryâs Serialize() Function
- Overview
- The Programming
- Accessing JSON Data
- Complex JSON Data
- Constructing the URL
- Finding Photos of Specific Things
- Combining options
- An Overview of the Application
- Add a Button
- Add a Dialog Box
- Adding Tasks
- Marking Tasks as Complete
- Event Delegation
- Editing Tasks
- Confirming Deletions
- Saving the Lists
- Local Storage
- Save to a Server
- 15. Getting the Most from jQuery
- Useful jQuery Tips and Information
- $() Is the Same as jQuery()
- Saving Selections into Variables
- Adding Content as Few Times as Possible
- Optimizing Your Selectors
- Reading a Page on the jQuery Docs Site
- Working with Strings
- Determining the Length of a String
- Changing the Case of a String
- Searching a String: indexOf() Technique
- Extracting Part of a String with slice()
- Creating and Using a Basic Regular Expression
- Building a Regular Expression
- Grouping Parts of a Pattern
- Useful Regular Expressions
- U.S. Zip Code
- U.S. Phone Number
- Email Address
- Date
- Web Address
- Matching Every Instance of a Pattern
- Changing a String to a Number
- Testing for Numbers
- Rounding Numbers
- Formatting Currency Values
- Creating a Random Number
- Randomly Selecting an Array Element
- A Function for Selecting a Random Number
- Getting the Month
- Getting the Day of the Week
- Getting the Time
- Changing Hours to A.M. and P.M.
- Padding Single Digits
- Creating a Date Thatâs One Week from Today
- Putting Preferences in Variables
- Putting Preferences in Objects
- Ternary Operator
- The Switch Statement
- Joining Arrays and Splitting Strings
- Using External JavaScript Files
- Creating Fast-Loading JavaScript
- Top JavaScript Programming Mistakes
- Non-Closed Pairs
- Quotation Marks
- Using Reserved Words
- Single Equals in Conditional Statements
- Case-Sensitivity
- Incorrect Path to External JavaScript File
- Incorrect Paths Within External JavaScript Files
- Disappearing Variables and Functions
- Opening the Console
- Viewing Errors with the Console
- Using console.log() to Track Script Progress
- Tutorial: Using the Console
- More Powerful Debugging
- Controlling Your Script with the Debugger
- Watching Your Script
- A. JavaScript Resources
- References
- Websites
- Books
- Websites
- Books
- Websites
- Books
- Articles and Presentations
- Websites
- Books
- Websites
- Books
Product information
- Title: JavaScript & jQuery: The Missing Manual, 3rd Edition
- Author(s): David Sawyer McFarland
- Release date: September 2014
- Publisher(s): O’Reilly Media, Inc.
- ISBN: 9781491948613
- References
- Useful jQuery Tips and Information
- Introducing Programming