JavaScript Design

 
   
  Table of Contents
JavaScript Design
By William B. Sanders
   
Publisher : New Riders Publishing
Pub Date : December 20, 2001
ISBN : 0-7357-1167-4
Pages : 600  

After mastering the design of basic web pages, the first scripting language you need to add to your portfolio is JavaScript. Even with eye-catching graphics and interesting text, today's web pages need the dynamic content offered by JavaScript to attract and keep viewers' interest. Things such as rollovers, pop-up boxes, and interactive web pages require more than HTML.

JavaScript Design is written with the designer in mind to help you master JavaScript and add a whole new dimension to your designs. In addition, to help you get started using databases with JavaScript, this book provides instructions to middleware such as CGI, ASP, PHP pages and SQL databases.

777

Copyright

About the Author

About the Technical Reviewers

Acknowledgments

Tell Us What You Think

Part I: Basic JavaScript

Chapter 1. Jump-Starting JavaScript

JavaScript Lives in a Web Page

Putting JavaScript into Your HTML Pages

What You Can Do with JavaScript That You Can't Do with HTML

An Interpreted Language

A Tale of Two Interpreters

Generated JavaScript

Summary

Chapter 2. An Orientation to JavaScript

Writing JavaScript

Naming Rules and Conventions

A Weakly Typed Language Means That JavaScript Is Smart

Summary

Chapter 3. Dealing with Data and Variables

Literals

Variables

Primitive and Compound Data

Arrays

Summary

Chapter 4. Using Operators and Expressions

General and Bitwise Operators

General Operators in JavaScript

Operators

Precedence

Summary

Chapter 5. JavaScript Structures

Statements in Sequential Structures

Conditional Structures

Loops

The

The

Summary

Chapter 6. Building and Calling Functions

Methods and Functions

Creating Functions

Firing Functions with Event Handlers

The

Using Functions as Data

Properties in Functions

Methods in Functions

Summary

Chapter 7. Objects and Object Hierarchies

Hierarchy of Objects in JavaScript

User-Defined Objects

Built-in Objects and Their Properties

Key Built-in Object Methods

Summary

Part 2: Using JavaScript with Web Pages

Chapter 8. JavaScript Object-Oriented Programming and the Document Object Model

Object-Oriented Programming in JavaScript

The Prototype Concept

The Document Object Model

Summary

Chapter 9. Frames and Addressing Frames in Windows

The Window as a Complex Object

Scripts That Write Scripts

Summary

Chapter 10. Event Handlers

The

Events and Event Handlers in HTML and JavaScript

Summary

Chapter 11. Making Forms Perform

The Many Types of Forms Elements in HTML

All Text Entries Are Strings

Passing Data Between Forms and Variables

Forms as Arrays

Types of Forms

Buttons and Their Events

Summary

Chapter 12. Dynamic HTML

What Is Dynamic HTML?

Cascading Style Sheets

Borders

External CSS Style Sheets

The Role of JavaScript in Dynamic HTML

Summary

Chapter 13. Remember with Cookies

What Are Cookies and How Are They Used?

Adding More Attributes

Getting Information and Giving It Back

Summary

Part I: JavaScript and Other Applications and Languages

Chapter 14. Using PHP with JavaScript

The PHP4 Scripting Language

Passing Data from JavaScript to PHP

Controlling Multiple PHP Pages with JavaScript

JavaScript Form Preprocessing for PHP

JavaScript, PHP, and MySQL

Summary

Chapter 15. Using ASP with JavaScript

Creating ASP Pages

Variables in VBScript

Operators and Conditional Statements

Loop Structures

Arrays

Passing Data from JavaScript to ASP

Controlling Multiple ASP Pages with JavaScript

Microsoft Access, ASP, and JavaScript

Setting Up the Access 2000 File

Placing the Access 2000 File on the Server and Preparing the DSN

Making the Connection Between Your ASP Page and Database File

Reading an Access 2000 Database with ASP

Reading and Displaying Multiple Fields

Inserting Records into Access from HTML

Summary

Chapter 16. CGI and Perl

Scripting with Perl

A Brief Perl Tutorial

Perl Operators

Perl Statements

File Handling in Perl

Passing Data to CGI from HTML

Summary

Chapter 17. Working with XML and JavaScript

The XML Mystique

What Is XML?

Reading and Showing XML Data with JavaScript

Summary

Chapter 18. Flash ActionScript and JavaScript

ActionScript and JavaScript

Firing a JavaScript Function from Flash

Passing Variables from Flash 5 to JavaScript

Summary

Chapter 19. JavaScript and Other Languages

JavaScript and Java Applets

A Little Java

JavaScript and ColdFusion

JavaScript and ASP.NET

Summary

Example Glossary

Copyright

FIRST EDITION: December, 2001

All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review.

Library of Congress Catalog Card Number: 2001096750

06 05 04 03 02 7 6 5 4 3 2 1

Interpretation of the printing code: The rightmost double-digit number is the year of the book's printing; the rightmost single-digit number is the number of the book's printing. For example, the printing code 02-1 shows that the first printing of the book occurred in 2002.

Printed in the United States of America

Trademarks

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. New Riders 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

This book is designed to provide information about JavaScript. 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 is provided on an as-is basis. The author and New Riders Publishing 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 web site or programs that may accompany it.

PUBLISHER

David Dwyer

ASSOCIATE PUBLISHER

Stephanie Wall

PRODUCTION MANAGER

Gina Kanouse

MANAGING EDITOR

Kristy Knoop

DEVELOPMENT EDITOR

John Rahm

PROJECT EDITOR

Jake McFarland

PRODUCT MARKETING MANAGER

Kathy Malmloff

PUBLICITY MANAGER

Susan Nixon

COPY EDITOR

Krista Hansing

SENIOR INDEXER

Cheryl Lenser

MANUFACTURING COORDINATOR

Jim Conway

BOOK DESIGNER

Barb Kordesh

COVER DESIGNER

Aren Howell

PROOFREADER

Jessica McCarty

COMPOSITION

Barb Kordesh

MEDIA DEVELOPER

Jay Payne

Dedication

This book is dedicated to my wife, Delia.

About the Author

graphics/intfig01.gif

Dr. William B. Sanders is a professor in the Interactive Information Technology program at the University of Hartford. The program is designed to develop students who will work in collaborative environments using the Internet and the World Wide Web and develop digital communicative technologies. Bill has written more than 35 computer-related books, with the goal of translating technology to a wide interest base. To mangle a phrase from Will Rogers, he never met a computer or computer language that he didn't like.

Like the revolution spawned by personal computers, the Internet and the World Wide Web have spawned another. The new languages and applications required to master and effectively use Internet technologies have been a focal interest of Bill's since the web's inception. He has been focused on languages such as JavaScript, PHP, ASP, XML, ActionScript, MySQL, and a host of other web-based programs and applications. However, instead of looking at the new technologies solely as a cool way to make things happen on the web, Bill has been involved with different aspects of e-business and e-commerce, bridging the digital divide in communities and generally looking at ways in which the Internet and the web serve as a lively linkage between people and their aspirations.

As a source of information and understanding, the web is unparalleled, but it is also an arena to explore new art forms and ways of human expression. Bill has sought out design concepts from Edward Tufte's work on information, Hillman Curtis's work on motion design, and David Siegel's work on third-generation web sites. For Bill, each new development in creativity, technology, and communication is an opportunity to see the world in a new light and expand horizons.

His hobbies include travel, Greater Swiss Mountain Dogs, and life with his wife, Delia.

About the Technical Reviewers

These reviewers contributed their considerable hands-on expertise to the entire development process for JavaScript Design. As the book was being written, these dedicated professionals reviewed all the material for technical content, organization, and flow. Their feedback was critical to ensuring that JavaScript Design fits our readers' need for the highest-quality technical information.

Josh Kneedler resides in Portland, Oregon. He is a founding partner of the visual media studio Dreaming America (http://dreamingamerica.com). With the support of Dreaming America, Josh has also started an online magazine called Rangermag (http://rangermag.com). Over the years since 1997, Josh has acquired a strong sense of both functionality and design. He can be reached at josh@dreamingamerica.com.

Joel Lee and Bryan Ginz are technical editors for JTL Networks, Inc. (JTLNET). Based in Columbus, Ohio, JTLNET provides a variety of information technology and consulting services for businesses, including managed web hosting, custom programming and design, remote administration, remote data storage, and network design. For more information on JTLNET, visit www.jtlnet.com.

Acknowledgments

This book began back in 1996 using JavaScript 1.1 and later JavaScript 1.2, when it became available. A group of us at the University of Hartford got together once a week to create problems to be solved with JavaScript and, much to my surprise and delight, many of the tools, applications, and utilities that we developed then, we still use today. Of those involved, the brightest of this group was and remains to be David Kelly. Dave developed a Quiz-Maker in JavaScript that still makes great online quizzes. He also seemed to be about five jumps ahead of the rest of us and was a great help to us all. Laura Spitz, a designer extraordinaire, still does extraordinary designs and uses JavaScript regularly in her work. She introduced me to BBEdit and HomeSite, which have yet to replace NotePad and SimpleText on my PC and Mac, respectively. Finally, Morris Hicks, who recently took over the Assistant Director of the Office of Information Technology position at Boise State University, was a regular with our group and provided a knowledgeable presence at our meetings.

Also at the University of Hartford, I'd like to thank the faculty and students in the Interactive Information Technology program. The students are an always creative lot who challenge the faculty to come up with better courses, answers, and scripts. Likewise, the IIT faculty, including John Gray, Jerry Katrichis, and David Demers, are a good group to kick ideas around with. Also, Steve Misovich and Lou Boudreau of the University of Hartford Hillyer College psychology faculty were a true inspiration as we developed a virtual psychology lab for the web. Everything from a rat maze to a timed reaction experiment were accomplished using JavaScript as part of a grant application to the National Science Foundation. During this project, I learned that there is very little that cannot be accomplished with JavaScript once a project goal has been set.

Next, I'd like to thank the people at New Riders. Thanks to Stephanie Wall, who worked with me to develop an outline for the book that would focus on designers' needs in working with and understanding JavaScript. Also, I would like to thank John Rahm for helping to develop everything just right and Jake McFarland for coordinating the details of the finishing touches. Thanks also to the copy and technical editors Krista Hansing, Josh Kneedler, Joel Lee, and Bryan Ginz for locating the glitches and setting them straight.

Finally, I'd like to thank my wife, Delia. As I was starting this book, she was beginning her doctoral work at Smith College, and so both of us were in our studies, thinking and writing together. Like everything else we do together, it brought us closer.

Tell Us What You Think

As the reader of this book, you are the most important critic and commentator. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way.

As the Associate Publisher for New Riders Publishing, I welcome your comments. You can fax, email, or write me directly to let me know what you did or didn't like about this book as well as what we can do to make our books stronger.

Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message.

When you write, please be sure to include this book's title and author as well as your name and phone or fax number. I will carefully review your comments and share them with the author and editors who worked on the book.

Fax:

317-581-4663

Email:

stephanie.wall@newriders.com

Mail:

Stephanie Wall
Associate Publisher
New Riders Publishing
201 West 103rd Street
Indianapolis, IN 46290 USA



JavaScript Design
JavaScript Design
ISBN: 0735711674
EAN: 2147483647
Year: 2001
Pages: 25

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net