Sams.Teach.Yourself.Ajax.JavaScript.and.PHP.All.in.One.Jul.2008.pdf

(4183 KB) Pobierz
143585954 UNPDF
143585954.014.png
Sams Teach Yourself
Ajax , JavaScript and PHP
All
in One
What you should already have to get the most out of this book…
• A familiarity with the basic workings of your computer, your operating system, and the Internet
• A good understanding of HTML and web page development
• Basic web server knowledge and administration may be helpful
Some books
that may
help with
the basics…
Sams Teach Yourself
Windows Vista
All in One
This book will teach
you the basics of using
your computer—and
Windows Vista—
effectively
Sams Teach Yourself Mac
OS X Leopard All in One
Covers all the most
important topics for the
reader who wants to get up
and running as quickly as
possible
What this book will help you learn…
• How to make JavaScript, HTML, XML, and PHP work together to create Ajax effects
• How to build better, more interactive interfaces for your web apps
Related
titles…
Sams Teach Yourself
HTML and CSS
in 24 Hours
Explains the basics for
creating a web page
with HTML and putting it
online
Sams Teach Yourself
JavaScript in 24 Hours
A good introduction
to creating interactive web
sites with JavaScript
Where you may want to go from here…
• Enhance your Ajax skills to build more complex web-based applications
• Expand your web development abilities by learning other languages and development technologies
Possible
titles to
look for…
Sams Teach Yourself
PHP, MySQL and
Apache All in One
A great introduction to
using PHP with MySQL
and Apache
Sams Teach Yourself
Django in 24 Hours
A detailed tutorial on
creating websites with the
Django framework
143585954.015.png 143585954.016.png 143585954.017.png 143585954.001.png 143585954.002.png 143585954.003.png 143585954.004.png 143585954.005.png 143585954.006.png 143585954.007.png 143585954.008.png 143585954.009.png 143585954.010.png
Phil Ballard
Michael Moncur
JavaScript
and PHP
All
in One
800 East 96th Street, Indianapolis, Indiana, 46240 USA
Sams Teach Yourself
Ajax ,
143585954.011.png
Sams Teach Yourself Ajax, JavaScript, and PHP All in One
Copyright © 2009 by Sams Publishing
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or
transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without
written permission from the publisher. No patent liability is assumed with respect to the use of
the information contained herein. Although every precaution has been taken in the preparation of
this book, the publisher and author assume no responsibility for errors or omissions. Nor is any
liability assumed for damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-32965-4
ISBN-10: 0-672-32965-4
Library of Congress Cataloging-in-Publication Data
Ballard, Phil.
Sams teach yourself Ajax, JavaScript, and PHP all in one / Phil
Ballard, Michael Moncur.
p. cm.
Includes index.
ISBN 978-0-672-32965-4 (pbk. : CD-ROM)
1. Ajax (Web site development technology) 2. JavaScript (Computer program language)
3. PHP (Computer program language) 4. Web site development. I. Moncur, Michael G.
II. Title. III. Title: Teach yourself Ajax, JavaScript, and PHP all in one.
TK5105.8885.A52B38 2008
006.7'6--dc22
Editor-in-Chief
Mark Taub
Acquisitions Editor
Mark Taber
Managing Editor
Patrick Kanouse
Project Editor
Mandie Frank
Indexer
Ken Johnson
Proofreader
Paula Lowell
Publishing
Coordinator
Vanessa Evans
Multimedia
Developer
Dan Scherf
Designer
Gary Adair
Composition
TnT Design, Inc.
2008022476
Printed in the United States of America
First Printing June 2008
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been
appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a
term in this book should not be regarded as affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no
warranty or fitness is implied. The information provided is on an “as is” basis. The authors and
the publisher shall have neither liability nor responsibility to any person or entity with respect to
any loss or damages arising from the information contained in this book or from the use of the
CD or programs accompanying it.
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk pur-
chases or special sales. For more information, please contact
U.S. Corporate and Government Sales
1-800-382-3419
corpsales@pearsontechgroup.com
For sales outside of the U.S., please contact
International Sales
international@pearson.com
143585954.012.png
Contents at a Glance
Introduction ............................................................................ 1
Part I: Web Basics Refresher
7
CHAPTER 1 Workings of the Web ................................................................ 9
2 Writing and Styling Pages in HTML and CSS .............................. 21
3 Anatomy of an Ajax Application .............................................. 41
Part II: Introducing Web Scripting with JavaScript
51
CHAPTER 4 Creating Simple Scripts in JavaScript ......................................... 53
5 Working with the Document Object Model (DOM) ....................... 71
6 Using Variables, Strings, and Arrays .......................................... 81
7 Using Functions and Objects .................................................. 103
8 Controlling Flow with Conditions and Loops ............................. 117
9 Using Built-In Functions and Libraries ..................................... 135
Part III: Introducing Ajax
147
CHAPTER 10 The Heart of Ajax—the XMLHTTPRequest Object ......................... 149
11 Talking with the Server .......................................................... 157
12 Using the Returned Data ........................................................ 167
13 Our First Ajax Application ..................................................... 175
Part IV: Server-side Scripting with PHP
185
CHAPTER 14 Getting to Know PHP ............................................................. 187
15 Variables ............................................................................. 195
16 Flow Control ........................................................................ 215
17 Functions ............................................................................ 223
18 Using Classes ....................................................................... 231
143585954.013.png
Zgłoś jeśli naruszono regulamin