Special Edition Using JScript
Copyright 1997 © by Que Corporation.
All rights reserved. Printed in the United States of America. No part of this book may be used or reproduced in any form or by any means, or stored in a database or retrieval system, without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this book for any purpose other than your own personal use is a violation of United States copyright laws. For information, address Que Corporation, 201 W. 103rd Street, Indianapolis, IN 46290. You may reach Que's direct sales line by calling 1-800-428-5331.
|President||Roland Elgey||Publisher||Joseph B. Wikert|
|Publishing Manager||Jim Minatel||Title Manager||Steven M. Schafer|
|Editorial Services Director||Elizabeth Keaffaber||Managing Editor||Sandy Doell|
|Director of Marketing||Lynn E. Zingraf||Acquisitions Manager||Cheryl D. Willoughby|
|Acquisitions Editor||Stephanie J. McComb||Product Director||Stephen L. Miller, Jon Steever|
|Senior Editor||Elizabeth A. Bruns||Editors||Kelli M. Brooks, Sean Dixon, Gill Kent, Patricia R. Kinyon|
|Product Marketing Manager||Kristine Ankney||Assistant Product Marketing Managers||Karen Hagen, Christy M. Miller|
|Strategic Marketing Manager||Barry Pruett||Technical Editors||Russ Jacobs, Faisal Jawdat|
|Technical Support Specialist||Mark Costlow, Nadeem Muhammed||Acquisitions Coordinator||Jane K. Brownlow|
|Editorial Assistant||Andrea Duvall||Book Designer||Ruth Harvey|
|Cover Designer||Dan Armstrong||Production Team||Marcia Brizendine, Maribeth Echard, Jessica Ford, Dan Julian|
Mark C. Reynolds has wide-ranging interests in network programming, Java, UNIX internals, and computer animation. He holds an M.S. degree in mathematics from M.I.T. He has edited and translated a number of works in the physical sciences and mathematics, including Stanislaus Ulam's posthumous collection of essays, "Science, Computers and People: From the Tree of Mathematics."
Jerry Honeycutt provides business-oriented technical leadership to the Internet community and software development industry. He has served companies such as The Travelers, IBM, Nielsen North America, IRM, Howard Systems International, and NCR. Jerry has participated in the industry since before the days of Microsoft Windows 1.0, and is completely hooked on Windows 95 and the Internet.
Jerry is the author of Using Microsoft Plus!, Using the Internet with Windows 95, Windows 95 Registry & Customization Handbook, Special Edition Using the Windows 95 Registry, VBScript by Example, Special Edition Using the Internet 3E, Using the Internet 2E, and Windows NT and Windows 95 Registry and Customization Handbook published by Que. He is also a contributing author on Special Edition Using Windows 95, Special Edition Using Netscape 2, Platinum Edition Using Windows 95, Visual Basic for Applications Database Solutions, Special Edition Using Netscape 3, Windows 95 Exam Guide, Netscape Navigator 3 Starter Kit, Using Java Workshop, Using JScript, and Internet Explorer ActiveX and Plug-Ins Companion published by Que. He has been printed in Computer Language magazine and is a regular speaker at the Windows World and Comdex trade shows on topics related to software development, Windows 95, and the Internet.
Jerry graduated from the University of Texas at Dallas in 1992 with a B.S. degree in Computer Science. He currently lives in the Dallas suburb of Frisco, Texas, with Becky, two Westies, Corky and Turbo, and a cat called Scratches. Jerry is an avid golfer with a passion for fine photography. Feel free to contact Jerry on the Internet at firstname.lastname@example.org or visit his Web site at http://rampages.onramp.net/~jerry.
The people at Que deserve a large measure of praise for their patience, perseverance, and hard work. I would especially like to thank Faisal Jawdat, Stephanie McComb, Stephen Miller, and Jon Steever for their technical assistance, ongoing support, guidance, and impressive organizational skills. Many other people at Que have also worked very hard on this book, and are to be congratulated on its outcome.
As part of our continuing effort to produce books of the highest possible quality, Que would like to hear your comments. To stay competitive, we really want you, as a computer book reader and user, to let us know what you like or dislike most about this book or other Que products.
You can mail comments, ideas, or suggestions for improving future editions to the address below, or send us a fax at (317) 581-4663. For the online inclined, Macmillan Computer Publishing has a forum on CompuServe (type GO QUEBOOKS at any prompt) through which our staff and authors are available for questions and comments.
In addition to exploring our forum, please feel free to contact me personally to discuss your opinions of this book. I'm email@example.com on the Internet.
Thanks in advance-your comments will help us to continue publishing the best books available on computer topics in today's market.
Although we cannot provide general technical support, we're happy to help you resolve problems you encounter that are related to our books, disks, or other products. If you need such assistance, please contact our Tech Support department at 800-545-5914, ext. 3833.
To order other Que or Macmillan Computer Publishing books or products, please call our Customer Service department at 800-835-3202, ext. 666.
Five years ago, the Internet was mostly the province of academics and programmers, and the World Wide Web was an obscure idea in the minds of a few researchers. Today, both are experiencing explosive growth and unparalleled interest. Web pages are being created at an astonishing rate. The fundamental challenge of Web page development is while it is easy to create a Web page, it is more difficult to create an attractive and exciting one.
HTML, the markup language that describes the appearance of a page, is easy to learn, and requires no background in programming. HTML has undergone several revisions in order to meet the expanding needs of Web page authors. However, there are limits to what can be achieved inside HTML. The Java programming language was introduced to dramatically extend the Web developer's set of tools, though it's more complex than HTML. Java is very easy to learn; however, like most programming languages, it isn't easy to master. JScript bridges this gap.
JScript offers the Web page author a new level of sophistication without requiring him or her to become a programmer. JScript brings dynamic and powerful capabilities to Web pages, yet JScript is no more difficult to learn than HTML. JScript can be used to solve common problems, such as validating forms input, and can also be used to create dramatic and visually appealing content, which would be impossible with HTML. The goal of this book is to completely explore JScript, from the mundane to the extraordinary. It is designed as an introduction, a reference, and a continuous source of ideas, so that you may continually improve the Web pages that you create.
JScript is a very new language-even newer than Java. Despite its newness, it has attracted great attention because of its expressive power. This book is directed to anyone who wants to master that power in order to create more attractive, dynamic, and interesting Web pages.
No programming knowledge is required to benefit from this book, but some knowledge of HTML and Web page authoring is assumed. No prior experience with JScript is required, either. This book is designed to be inclusive, and provide information to all JScript users, from complete beginners to established experts. If you create Web pages and wish to enliven and enhance them, this book adds JScript to your toolbox. If you have already learned JScript and wish to go further and break through to complete mastery, this book gives you the information to do so.
The organization of this book is based upon a modular approach to learning JScript. The intent is to provide material suitable for all levels of knowledge, from the complete beginner to the advanced JScript programmer. To this end, the book has four sections.
Part I, "JScript: The Language," introduces the JScript language. The complete syntax and semantics of the language are thoroughly described, with particular attention paid to the close correspondence between HTML elements and JScript objects. Chapter 1, "What Is JScript?" discusses JScript's overall role in the development of Web pages. Chapter 2, "JScript: The Language," gives the syntax of JScript. This leads directly into a description of the relationship between events on a Web page and JScript in Chapter 3, "Events and JScript." This is followed by an introduction to the all-important topic of JScript objects in Chapter 4, "JScript Objects."
Part II, "JScript Objects," is a greatly expanded presentation of the JScript object model that begins in Chapter 4 of Part I. JScript objects can be classified as built-in objects or HTML objects. Built-in objects are thoroughly described in Chapter 5, "Built-In JScript Objects," while Chapters 6 through 8 focus on HTML objects. Validation of HTML forms is the subject of Chapter 6; each form element is also a JScript object. Navigation objects, such as links and anchors, are then described in Chapter 7, while Chapter 8 presents the top-level objects associated with the Web browser itself. Part II concludes with a thorough treatment of user-defined objects in Chapter 9.
One of the tremendous advantages of a scripting language such as JScript is its ability to integrate diverse technologies on a single Web page. Part III is devoted to examining such technologies. The Java programming language has received massive attention, and is quite similar to JScript in structure. Chapter 10 provides a thorough introduction to Java, while Chapter 11 focuses on the critical topic of Web page animation using Java. Chapter 12 introduces the concept of embedded objects using Microsoft's ActiveX technology. Finally, Chapter 13 provides a closer look at the internals of ActiveX controls.
Part IV brings the user the most advanced material available on creating special effects using JScript. Controlling Web page appearance, producing spectacular visual effects, and fine-tuning user interaction are each the subject of an in-depth treatment in Chapters 14 through 17. Each chapter contains at least one fully worked example that can be used immediately. The various development tools for JScript and live content are covered in Chapter 18. Part IV concludes with an in-depth look at active content development using the ActiveX control pad in Chapter 19.
If you are completely new to JScript, then you should begin with a thorough study of the introductory language materials of Part I. This should be followed by the more thorough treatment of JScript objects in Part II. From that point on, any chapter or section can be consulted, based on your own particular interest. It should be noted that later chapters are generally more advanced than earlier ones, however.
If you are already familiar with JScript, then you are encouraged to explore this book in a goal-oriented manner. The alternate technologies discussed in Part III may well be new to you, even if you are an experienced Web professional. Finally, Part IV should have something new and informative for everyone, as it is intended to stretch the limits of JScript technology.
Que has more than a decade of experience writing and developing the most successful computer books available. With that experience, we've learned what special features help readers the most. Look for these special features throughout the book to enhance your learning experience.
The following font conventions are used in this book to help make reading it easier.
Tips present short advice on a quick or often overlooked procedure. These include shortcuts.
Notes present interesting or useful information that isn't necessarily essential to the discussion. A note provides additional information that may help you avoid problems or offers advice that relates to the topic.
Cautions look like this and warn you about potential problems that a procedure may cause, unexpected results, or mistakes to avoid.