jquery recipes

455 606 0
jquery recipes

Đ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

this print for content only—size & color not accurate trim = 7.5" x 9.25" spine = 0.000" 000 page count BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® Harwani jQuery Recipes Companion eBook Available US $44.99 Shelve in: Web Development User level: Intermediate www.apress.com SOURCE CODE ONLINE Companion eBook See last page for details on $10 eBook version ISBN 978-1-4302-2709-0 9 781430 227090 5 44 9 9 jQuery Recipes: A Problem-Solution Approach Dear Reader, The jQuery framework is fantastically powerful and elegant, but it still has enough thorny edges to snag unwary users. jQuery Recipes is chock full of solu- tions to those thorny problems, over a hundred of them, ranging from the com- mon to the more obscure. We cover areas such as: • Handling keyboard and mouse events • Form validation techniques • Applying animation effects • Manipulating the DOM • Advanced table handling • Working with JSON and XML data For each problem, we carefully define what the issue is first, and then pro- vide the code solution along with any required HTML and CSS to get the exam- ple working. Where there are numerous permutations to the problem, we’ll run through a set of solutions to keep you fully armed for all eventualities. The code is then carefully explained so that you understand the core details of the solution and can apply them to your own code any time you come across a similar issue. Along with using the book as a reference to dip into for answers, you can also use it for increasing your knowledge of jQuery. By reading through the solutions and trying out the fully illustrated and explained sample code, you will gain a bet- ter understanding of the inner workings of the jQuery framework and how it can be used to make your websites more dynamic and sticky. B.M. Harwani THE EXPERT’S VOICE ® IN WEB DEVELOPMENT jQuery Recipes A Problem-Solution Approach B.M. Harwani An expert compilation of solutions to real-world jQuery problems THE APRESS ROADMAP jQuery Recipes Practical JavaScript Projects Beginning JavaScript Pro JavaScript Techniques Pro JavaScript RIA Techniques CYAN MAGENTA YELLOW BLACK PANTONE 123 C B.M. Harwani Author of Foundation Joomla More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info this print for content only—size & color not accurate trim = 7.5" x 9.25" spine = 0.000" 000 page count BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® Harwani jQuery Recipes Companion eBook Available US $44.99 Shelve in: Web Development User level: Intermediate www.apress.com SOURCE CODE ONLINE Companion eBook See last page for details on $10 eBook version ISBN 978-1-4302-2709-0 9 781430 227090 5 44 9 9 jQuery Recipes: A Problem-Solution Approach Dear Reader, The jQuery framework is fantastically powerful and elegant, but it still has enough thorny edges to snag unwary users. jQuery Recipes is chock full of solu- tions to those thorny problems, over a hundred of them, ranging from the com- mon to the more obscure. We cover areas such as: • Handling keyboard and mouse events • Form validation techniques • Applying animation effects • Manipulating the DOM • Advanced table handling • Working with JSON and XML data For each problem, we carefully define what the issue is first, and then pro- vide the code solution along with any required HTML and CSS to get the exam- ple working. Where there are numerous permutations to the problem, we’ll run through a set of solutions to keep you fully armed for all eventualities. The code is then carefully explained so that you understand the core details of the solution and can apply them to your own code any time you come across a similar issue. Along with using the book as a reference to dip into for answers, you can also use it for increasing your knowledge of jQuery. By reading through the solutions and trying out the fully illustrated and explained sample code, you will gain a bet- ter understanding of the inner workings of the jQuery framework and how it can be used to make your websites more dynamic and sticky. B.M. Harwani THE EXPERT’S VOICE ® IN WEB DEVELOPMENT jQuery Recipes A Problem-Solution Approach B.M. Harwani An expert compilation of solutions to real-world jQuery problems THE APRESS ROADMAP jQuery Recipes Practical JavaScript Projects Beginning JavaScript Pro JavaScript Techniques Pro JavaScript RIA Techniques CYAN MAGENTA YELLOW BLACK PANTONE 123 C B.M. Harwani Author of Foundation Joomla More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info jQuery Recipes ■ ■ ■ B.M. Harwani More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info jQuery Recipes Copyright © 2010 by B.M. Harwani All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2709-0 ISBN-13 (electronic): 978-1-4302-2710-6 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. President and Publisher: Paul Manning Lead Editor: Steve Anglin Developmental Editor: Matthew Moodie Technical Reviewer: Massimo Nardone Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Kelly Moritz Copy Editor: Candace English Production Support: Patrick Cunningham Indexer: Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders- ny@springer-sbm.com, or visit http://www.springeronline.com. For information on translations, please e-mail info@apress.com, or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info To my mother Mrs. Nita Harwani. My mother is next to God for me. Whatever I am today is just because of the Moral values taught by her To Dennis Ritchie and Ken Thompson - the creators of UNIX. I appreciate Ken Thompson’s work with B programming language and have been fond of programming in Ritchie’s invention: ‘C’ programming language since I was doing Engineering. I am a great admirer of the security features of Unix and used to love making shell scripts on UNIX operating sytem during my study days. Their achievments are the inspiration for the millions of programmers around the world. More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info iv Contents at a Glance About the Author xxviii About the Technical Reviewer xxix Acknowledgments xxx Introduction xxxi ■Chapter 1: jQuery Basics 1 ■Chapter 2: Arrays and Strings 17 ■Chapter 3: Event Handling 45 ■Chapter 4: Form Validation 107 ■Chapter 5: Page Navigation 167 ■Chapter 6: Visual Effects 199 ■Chapter 7: Dealing with Tables 253 ■Chapter 8: Ajax 291 ■Chapter 9: Using Plugins 327 ■Chapter 10: Using CSS 357 Index 409 More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info v Contents About the Author xxviii About the Technical Reviewer xxix Acknowledgments xxx Introduction xxxi ■Chapter 1: jQuery Basics 1 1-1. Installing jQuery 1 Problem 1 Solution 2 How It Works 2 1-2. Selecting Nodes in the DOM 2 Problem 2 Solution 2 How It Works 3 1-3. Delaying the Execution of JavaScript 3 Problem 3 Solution 3 How It Works 3 1-4. Applying CSS to Elements 4 Problem 4 Solution 4 How It Works 4 More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info ■ CONTENTS vi 1-5. Selecting a Non-Standard Series of HTML Elements 4 Problem 4 Solution 4 How It Works 5 1-6. Counting the Number of Nodes in the DOM and Displaying Their Text 5 Problem 5 Solution 5 How It Works 6 1-7. Obtaining the HTML of an Element 8 Problem 8 Solution 8 How It Works 8 1-8. Changing the Content of a DOM Node 9 Problem 9 Solution 9 How It Works 10 1-9. Creating a DOM Node on the Fly 11 Problem 11 Solution 12 How It Works 13 1-10. Assigning the Same Class Name to Different HTML Elements and Applying Styles to Them 14 Problem 14 Solution 15 How It Works 16 Summary 16 More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info ■ CONTENTS vii ■Chapter 2: Arrays and Strings 17 2-1. Displaying Names in a List Using Arrays 17 Problem 17 Solution 18 How It Works 19 2-2. Manipulating Array Elements 21 Problem 21 Solution 21 How It Works 23 2-3. Filtering Arrays to Show Desired Data Only 24 Problem 24 Solution 24 How It Works 25 2-4. Sorting String and Numerical Arrays 30 Problem 30 Solution 30 How It Works 31 2-5. Splitting an Array 33 Problem 33 Solution 33 How It Works 34 2-6. Combining Two Arrays 35 Problem 35 Solution 35 How It Works 36 More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info ■ CONTENTS viii 2-7. Converting a Numerical Array into a String and Finding Its Substring 37 Problem 37 Solution 37 How It Works 37 2-8. Creating an Array of Objects 38 Problem 38 Solution 38 How It Works 39 2-9. Sorting an Array of Objects 40 Problem 40 Solution 41 How It Works 42 Summary 43 ■Chapter 3: Event Handling 45 3-1. Finding Out Which Button Is Clicked 46 Problem 46 Solution 46 How It Works 48 3-2. Triggering Events Automatically 50 Problem 50 Solution 51 How It Works 51 trigger() 52 3-3. Disabling a Button After It Is Clicked Once 52 Problem 52 Solution 53 How It Works 53 More Free Ebook: www.latestebook.com More Free Ebook: www.latestebook.com www.it-ebooks.info [...]... that can complement your jQuery code Because CSS is a basic jQuery skill, we'll also include some basic CSS recipes 1-1 Installing jQuery Problem You want to install jQuery so you can use it in your application and follow the recipes in this book 1 More Free Ebook: www.latestebook.com www.it-ebooks.info More Free Ebook: www.latestebook.com CHAPTER 1 ■ JQUERY BASICS Solution jQuery comes as a single... download and install jQuery in any web application Download the latest version of jQuery from its official site: http:/ /jquery. com/ This book uses version jquery- 1.3.2 Copy the downloaded file to the folder where you are going to write jQuery programs The statement to load the jQuery library is written in the head tag of the HTML file and the statement is as follows: In almost all the recipes, we will be adding the following three lines in HTML files (in the head tag): How It Works The . 9 9 jQuery Recipes: A Problem-Solution Approach Dear Reader, The jQuery framework is fantastically powerful and elegant, but it still has enough thorny edges to snag unwary users. jQuery Recipes. IN WEB DEVELOPMENT jQuery Recipes A Problem-Solution Approach B.M. Harwani An expert compilation of solutions to real-world jQuery problems THE APRESS ROADMAP jQuery Recipes Practical JavaScript. 9 9 jQuery Recipes: A Problem-Solution Approach Dear Reader, The jQuery framework is fantastically powerful and elegant, but it still has enough thorny edges to snag unwary users. jQuery Recipes

Ngày đăng: 24/04/2014, 15:24

Mục lục

  • Apress - jQuery Recipes (January 2010) (ATTiCA)

  • Contents at a Glance

  • About the Technical Reviewer

  • Introduction

    • What the book is about

    • Who the book is for

    • What you will learn from this book

    • 1-2. Selecting Nodes in the DOM

      • Problem

      • 1-3. Delaying the Execution of JavaScript

        • Problem

        • 1-4. Applying CSS to Elements

          • Problem

          • 1-5. Selecting a Non-Standard Series of HTML Elements

            • Problem

            • 1-6. Counting the Number of Nodes in the DOM and Displaying Their Text

              • Problem

              • 1-7. Obtaining the HTML of an Element

                • Problem

                • 1-8. Changing the Content of a DOM Node

                  • Problem

                  • 1-9. Creating a DOM Node on the Fly

                    • Problem

                    • 1-10. Assigning the Same Class Name to Different HTML Elements and Applying Styles to Them

                      • Problem

                      • Arrays and Strings

                        • 2-1. Displaying Names in a List Using Arrays

                          • Problem

                          • Displaying Names One Below the Other

                          • Displaying Names with Their Position in the Array

                          • Making the Array from HTML Elements and Counting the Array Length

                          • Converting Names to Uppercase

Tài liệu cùng người dùng

Tài liệu liên quan