Platinum
Edition


Using
HTML 3.2, Java 1.1, and CGI

Written by Eric Ladd and Jim O'Donnell with

Jerry Ablan, Tobin Anthony, Donald Doherty, Jeffry Dwight, Mike Ellsworth, Michael Erwin, Simeon Greene, John Jung, Greg Knauss, Tom Lockwood, Mike Morgan, Robert Niles, Bernie Roehl, Paul Santa Maria, Ryan Sutter


CONTENTS

Introduction

Chapter 1   Page Design

Chapter 2   Site Design

Chapter 3   Building Blocks of HTML

Chapter 4   The Document Tags

Chapter 5   Formatting the Document Body

Chapter 6   Displaying Content in Lists

Chapter 7   Linking HTML Documents

Chapter 8   Adding Graphics to HTML Documents

Chapter 9   Image Maps

Chapter 10   Graphics Tips and Tricks for Web Sites

Chapter 11   HTML Forms

Chapter 12   Tables

Chapter 13   Frames

Chapter 14   HTML Style Sheets

Chapter 15   Netscape Navigator-Specific HTML Extensions

Chapter 16   Internet Explorer-Specific HTML Extensions

Chapter 17   Proposed Additions to HTML

Chapter 18   Using Netscape Navigator Gold

Chapter 19   Using Microsoft FrontPage

Chapter 20   Using Adobe PageMill

Chapter 21   HTML Validation

Chapter 22   Key Graphics Utilities for Webmasters

Chapter 23   Key Web Access and Security Concerns for Webmasters

Chapter 24   Developing Webs with Netscape LiveWire and LiveWire Pro

Chapter 25   Developing Content for Plug-Ins

Chapter 26   Adding Video to Your Site

Chapter 27   Adding Audio to Your Web Site

Chapter 28   Adding Live or Streamed Media to Your Site

Chapter 29   Shocking Your Web Site

Chapter 30   Document Types for Business

Chapter 31   The Common Gateway Interface

Chapter 32   Generating HTML in Real Time

Chapter 33   Server-Side Includes

Chapter 34   Transactions and Order Taking

Chapter 35   CGI Security

Chapter 36   Custom Database Query Scripts

Chapter 37   Web Database Tools

Chapter 38   Client Pull/Server Push

Chapter 39   News and Mailing List Gateways

Chapter 40   Creating Live Chat Pages

Chapter 41   JavaScript

Chapter 42   Developing Java Applets

Chapter 43   User Input and Interactivity with Java

Chapter 44   Java Graphics and Animation Programming

Chapter 45   Network Programming and Java

Chapter 46   Java and Security

Chapter 47   Developing with LiveConnect

Chapter 48   ActiveX Scripting: VB Script and Jscript

Chapter 49   ActiveX Controls

Chapter 50   Web Authoring with ActiveX Controls

Chapter 51   ActiveX Documents

Chapter 52   Creating VRML Objects

Chapter 53   Creating VRML Worlds

Chapter 54   VRML 2.0: Moving Worlds

Chapter 55   Java and VRML

Chapter 56   Indexing with CGI

Chapter 57   Adding an Online Search Engine

Credits


Copyright© 1996 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.

ISBN: 0-7897-0932-5


HTML conversion by :
    M/s. LeafWriters (India) Pvt. Ltd.
    Website : http://leaf.stpn.soft.net
    e-mail : leafwriters@leaf.stpn.soft.net



PresidentRoland Elgey PublisherJoseph B. Wikert
Publishing ManagerJim Minatel Editorial Services DirectorElizabeth Keaffaber
Managing EditorSandy Doell Director of MarketingLynn E. Zingraf
Acquisitions ManagerCheryl D. Willoughby Acquisitions EditorsStephanie Gould, Stephanie McComb, Philip Wescott
Product DirectorsBenjamin Milstead, Mark Cierzniak, Jácquelyn D. Eley, Stephen L. Miller, Steven M. Schafer, Jon Steever
Senior EditorsPatrick Kanouse, Caroline D. Roop, Susan Ross Moore Production EditorBill McManus
EditorsKelli Brooks, Elizabeth Bruns, Sean Dixon, Sherri Fugit, Aaron Gordon, Patricia Kinyon, Judy Ohm, Jade Williams
Assistant Product Marketing Managers Karen Hagen, Christy M. Miller Strategic Marketing ManagerBarry Pruett
Technical EditorsBill Bruns, Matthew Brown, Kyle Bryant, Brian Cooper, Jim Hofman, Russ Jacobs, Jon Sahaydak, Ernie Sanders, Tony Schafer, Glenn Smith, Henry Staples
Technical Support SpecialistsMark Costlow, Nadeem Muhammed Acquisitions CoordinatorJane K. Brownlow
Software Relations CoordinatorPatty Brooks Editorial AssistantsJennifer Condon, Andrea Duvall
Book DesignerRuth Harvey Cover DesignerJay Corpus
Production TeamKevin Cliburn, Maribeth Echard, Trey Frank, Julie Geeting, Tammy Graham, Jason Hand, Daniel Harris, Kay Hoskin, Tony McDonald, Anjy Perry, Casey Price, Erich Richter, Kaylene Riemen, Nicole Ruessler, Sossity Smith, Staci Somers, Lisa Stumpf, Marvin Van Tiem, Donna Wright
IndexerBrad Herriman, Craig Alan Small


About the Authors

Eric Ladd (erl1@access.digex.net) is an Internet/World Wide Web consultant in the Washington, DC metropolitan area. He currently works (by day) for Advanced Technology Systems in McLean, Virginia. By night, he toils endlessly for Macmillan Computer Publishing, contributing to such titles as Running a Perfect Netscape Site, Special Edition Using Internet Explorer 3, and Special Edition Using the World Wide Web.

Eric earned B.S. and M.S. degrees in mathematics from Rensselaer Polytechnic Institute in Troy, New York, where he also taught calculus, linear algebra, differential equations, and complex variables for six years.

Outside of work and writing, Eric enjoys running, hitting the gym, reading, and chatting on IRC. He lives in Washington, DC, with his Boxer puppy Zack.

Jim O'Donnell was born on October 17, 1963, in Pittsburgh, Pennsylvania. After a number of unproductive years, he began his studies in electrical engineering at Rensselaer Polytechnic Institute. He liked that so much that he spent eleven years there getting three degrees, graduating for the third (and final) time in the summer of 1992. He now lives deep in the heart of Dupont Circle and can be found plying his trade at the NASA Goddard Space Flight Center. He's not a rocket scientist, but he's close.

Jim's first experience with a "personal" computer was in high school with a Southwest Technical Products computer using a paper tape storage device, quickly graduating up to a TRS-80 Model II. His fate as a computer geek was sealed when Rensselaer gave him an Atari 800. After a long struggle, Jim finally chucked his Atari and joined the Windows world. When he isn't writing or researching for Que or talking on IRC (Nick: JOD), Jim likes to run (25-45 miles a week), row (starboard/counterstroke), play hockey (defense... no slapshot to speak of, though), collect comic books (favorite is currently Strangers in Paradise) and PEZ dispensers (104 and counting), and play the best board game ever, Cosmic Encounter.

Jerry Ablan (munster@mcs.net) is a Senior Software Engineer at the Chicago Board Options Exchange and has been involved in computers since 1982. He has worked on and owned a variety of microcomputers as well as programmed in many languages. Jerry lives in a Chicago suburb with his wife Kathryn.

Tobin Anthony holds a Ph.D. in aerospace engineering and works at NASA's Goddard Space Flight Center in Greenbelt, MD. He spends what little free time he has with his wife Sharon and three small children. Tobin has authored several journal articles as well as a book on constructing intranets. He can be reached at tobin@pobox.com; his Web site is at http://www.pobox.com/~tobin.

Dr. Donald Doherty is a neuroscientist and a computer expert. He received his Ph.D. from the Department of Psychobiology at the University of California, Irvine. Don's computer experience includes programming large scale computer models of brain systems. He's written on a wide range of computer topics. You can reach him by e-mail at Brainstage@sprintmail.com or visit his home page at http://ourworld.compuserve.com/homepages/Brainstage/ddoherty.htm.

Jeffry Dwight is CEO of Greyware Automation Products, a consulting firm specializing in custom applications and Internet-related utilities. Jeffry is a certified engineer with expertise in dozens of operating systems and programming languages. He lives in Dallas, Texas.

Mike Ellsworth is Development Manager, Advanced Technology and the Webmaster for A.C. Nielsen Company. He established the corporate Web site and has developed two information delivery services for Nielsen: BrokerNet and SalesNet. While developing these Web services, he did extensive CGI programming, including interfacing with legacy systems. He holds a degree in psychology from Duke University and received writing training at the University of Denver. Mike and his family live in Minnesota.

Michael Erwin is a monthly columnist in Boardwatch Magazine, Mike has been a featured speaker at ONE BBSCON, where he has helped numerous others to become Internet service and Web space providers. Mike also currently works in the IT department of INCO Alloys International, Inc. He's also a partner in eve, Inc., an ISP consulting firm, which has also given him the opportunity to publish "The WebMasters Resource" CD-ROM series. You can find Michael on the Web at http://www.eve.net/~mikee or you can e-mail him at mikee@eve.net.

Simeon Greene is the Internet Project Coordinator for Data-Core Systems (http://www.dclgroup.com) in Philadelphia. Simeon can be reached at smgree@dclgroup.com or http://www.well.com/~smgree.

John Jung has been a contributing author for almost half a dozen books. When he's not working on books, he has a day job that he thoroughly enjoys. As a professional systems administrator for a worldwide information services company, he's around computers all day. You can reach John at jjung@netcom.com.

Greg Knauss lives in Los Angeles with his wife, Joeanne, and works as a UNIX and Windows programmer. He graduated from the University of California, San Diego with a degree in Political Science but has beeen programming and writing about computers for over fifteen years. He has previously worked on Using HTML for Que.

Tom Lockwood has twelve years experience as a technical writer and marketing specialist with several computer graphic companies. He is currently employed at Cinebase Software where he championed the development of their Web site. Tom is also a freelance writer, a softball coach, and, most proudly, an Aries. He can be reached at tom.lockwood@cinesoft.com or via his personal Web site at http://www.cris.com/~tlockwoo.

Michael Morgan is founder and President of DSE, Inc., a full-service Web presence provider and software development shop. The DSE team has developed software for such companies as Intellect, Magnavox, DuPont, the American Biorobotics Company and Satellite Systems Corporation, as well as for the Government of Iceland and the Royal Saudi Air Force. The author of over twenty technical papers and presentations on various aspects of information technology, he is the co-developer of the Project Unit Costing Method, which allows project managers to construct justifications for information technology projects based on cost savings and cost avoidance. He lives in Virginia Beach with his wife, Jean, and their six children.

Robert Niles is a systems administrator and Web programmer for InCommand, Inc., a company located in Yakima, Washington that specializes in Internet and intranet applications. Robert lives in Selah, Washington with his wife, Kimberly; his son, Michael, and his daughter, Shaela. You can find him on the Web at http://www.sehal.net/ or via e-mail at rniles@imtired.selah.net.

Bernie Roehl is a software developer based at the University of Waterloo in Ontario, Canada. He is probably best known in VR circles for REND386 and AVRIL, free VR software packages that are still in widespread use by hobbyists. REND386 won the 1995 Meckler award for outstanding software achievement. He is also the author of two books on VR, Virtual Reality Creations and Playing God: Creating Virtual Worlds, and he recently co-authored Que's Special Edition Using VRML. He is currently writing for VR News, CyberEdge Journal, and WebSMITH and has previously written for VR World and VR Special Report. He is also a popular speaker on VR and VRML at various conferences throughout the year. His home page is http://ece.uwaterloo.ca/~broehl/bernie.html.

Paul Santa Maria has been a programmer for nearly 15 years. He earned his M.S. in Software Engineering in 1994 and now works for a large imaging corporation in southern California.

Ryan Sutter is a consultant with APG-USA specializing in HTML, Java, JavaScript, Powerbuilder, and Visual Basic, as well as a freelance writer and WWW developer. He started programming Basic on a Commodore VIC20 and has also worked in Clipper, C, and Perl. He is a confessed Internet addict and father of a terribly cute baby boy named Sydney. He can be found on the Web at http://www.skypoint.com/members/trex/ and via e-mail at trex@skypoint.com.

Acknowledgments

A tome like this doesn't write itself. It is the result of the orchestrated efforts of many; all of whom deserve recognition. Jim and Eric would like to thank the entire staff at Que that helped with this book-especially Cheryl Willoughby, Ben Milstead, J‡cqulyn Eley, Philip Wescott, Patrick Kanouse, and Bill McManus-for their support and assistance over the course of this project. They would also like to thank the cadre of contributing authors and technical editors, without whom this book would have been woefully incomplete. Finally, they want to express a special note of thanks to Doshia Stewart, for believing in them.

Eric would also like to thank: Chad Cipiti (http://www.clark.net/pub/wick/) for assistance with graphics issues and for creating custom graphics for the image maps chapter; John Guzman for helping to work off his frustrations at the gym; Jim O'Donnell for taking care of many of the administrative issues and for running to Prego for sandwiches; Phil Tiburcio for giving him his first HTML lesson during psychobiology class; and a cast of thousands for their encouragement and support: Mom, Dad, Brenda, Lona Dallessandro, Bob Leidich, Kurt Collins, John Steiner, Tony Vincent, Anthony Smith, and many, many others.

Jim wants to thank his family; Mom and Dad instilled a love of books, both reading and writing, that continues to this day. Jim would also like to extend his thanks to his roommates, friends (particularly the Tuesday Night Poker Bunch-Brian, Stuart, Richard, Patrick, and Chris), and teammates (Go DC Strokes! Go DC Nationals!). And he'd like to add an extra special thank you and IRC *BIG HUG* to Dimas, Tygrr, HotThang, CoCaCola, and the rest of the Soho/IRC bunch for their friendship and help. Hey guys, it's "After The Book!" (No, really, this time...)

We'd Like to Hear from You!

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. The address of our Internet site is http://www.mcp.com (World Wide Web).

In addition to exploring our forum, please feel free to contact me personally to discuss your opinions of this book: I'm bmilstead@que.mcp.com on the Internet, and I'm 102121,1324 on CompuServe.

Thanks in advance-your comments will help us to continue publishing the best books available on computer topics in today's market.

Benjamin Milstead
Product Development Specialist
Que Corporation
201 W. 103rd Street
Indianapolis, Indiana 46290
USA

NOTE
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.


Introduction

The Hypertext Markup Language (HTML) and the World Wide Web altered the face of the Internet and of personal computing forever. At one time regarded as the province of universities and government organizations, the Internet has grown to touch more and more lives everyday. And the multimedia content that can be provided via HTML and other Web technologies such as Java and CGI makes the Web an exciting place to be.

Through the efforts of standards organizations, such as the World Wide Web Organization and the VRML Architecture Group and those of companies such as Netscape, Microsoft, Macromedia, and Sun Microsystems, the HTML and other languages and technologies used to present information over the Web continue to develop and evolve. The number of possibilities for providing information content over the Web is astounding and growing every day.

That's where Platinum Edition Using HTML 3.2, Java 1.1, and CGI steps in to help. This book is the single source you need to quickly get up to speed and greatly enhance your skill and productivity in providing information on the World Wide Web.

How to Use This Book

This book was designed and written from the ground up with two important purposes:

With these goals in mind, how do you use this book?

If you are familiar with HTML and with setting up Web pages and Web sites, you may be able to just skim through the first couple of chapters to see what some of the issues in page and site design are and glance through the basic HTML elements discussed in the first two or three parts. Even if you are familiar with HTML, there may be some information in them that will be new to you. You can then read the advanced sections on HTML, as well as the sections on other Web technologies such as JavaScript and Java, CGI, VRML, and ActiveX technologies to determine which of those elements you want to include in your Web pages.

Platinum Edition Using HTML 3.2, Java 1.1, and CGI was written with the experienced HTML programmer in mind. Your experience may be limited to a simple Web home page you threw together, or you may be designing and programming Web sites. Either way, you will find comprehensive coverage on HTML and other Web technologies. Throughout this book, there are techniques for creating quality, effective Web pages and Web sites.

How This Book Is Organized

Part I: Introducing HTML

Chapter 1 "Page Design," gives you an overview of some of the issues that need to be considered when designing and laying out high quality, effective Web pages.

Chapter 2 "Site Design," discusses the issues concerned with going from Web page design to Web site design-how to establish a consistent look-and-feel and organization to your Web pages so they come together to form a coherent whole.

Chapter 3 "Building Blocks of HTML," teaches you the basic language and vocabulary of the Hypertext Markup Language (HTML), the primary tool you will need to use to build your Web pages.

Part II: Working with HTML Documents

Chapter 4 "The Document Tags," discusses the HTML tags located in the HTML head section, which normally contain the identifying information of the Web documents.

Chapter 5 "Formatting the Document Body," describes the basic HTML tags used to format text within the body of HTML documents. Some tips for effectively organizing and presenting text information so that it is clear and easy to read are also discussed.

Chapter 6 "Displaying Content in Lists," discusses the different HTML tags for displaying information in lists and shows how they can be used to organize and present sequential information.

Chapter 7 "Linking HTML Documents," discusses the hypertext link, the HTML tool used to link Web pages, images, sounds, and other multimedia content over the Internet. The hypertext link is the central building block of the World Wide Web, and this chapter discusses the many different uses to which it can be put.

Part III: HTML Graphics

Chapter 8 "Adding Graphics to HTML Documents," talks about the basic HTML tag used to include graphics in an HTML document and discusses the different graphics formats and display options that are supported. The chapter also discusses some of the many uses to which graphics can be put.

Chapter 9 "Image Maps," shows how graphics can be used as image maps-graphical navigation aids formatted to allow the user to link to other URLs by clicking sections of the graphic. Both server-side, where the processing of the user input is done on the server, and client-side, where this processing is done locally, image maps are discussed.

Chapter 10, "Graphics Tips and Tricks for Web Sites," talks about some of the sophisticated methods and uses to which graphics can be put in a Web page.

Part IV: Advanced HTML Functions

Chapter 11, "HTML Forms," talks about HTML forms, the primary way that user input and interactivity are currently supported in Web pages.

Chapter 12, "Tables," discusses the use of HTML tables, both to present data and information in a tabular format and also to achieve great control of the relative placement and alignment of HTML text, images, and other objects.

Chapter 13, "Frames," shows you how to split the Web browser window into different frames and use each to display a different HTML document. Some of the potential uses to which frames can be put are also shown and discussed.

Chapter 14, "HTML Style Sheets," takes a look at one of the latest formatting options available in HTML style sheets. Style sheets are a way of setting up a custom document template that gives the Web page author a great deal more control over how Web pages will look to their users.

Part V: HTML Extensions and Additions

Chapter 15, "Netscape Navigator-Specific HTML Extensions," discusses the HTML extensions that are currently supported only by the Netscape Navigator Web browser and discusses the relative advantages and disadvantages of using them in your Web pages.

Chapter 16, "Internet Explorer-Specific HTML Extensions," talks about the HTML elements that are only supported in Microsoft Internet Explorer.

Chapter 17, "Proposed Additions to HTML," discusses some of the proposed additions to the HTML standard that are not yet supported by any mainstream Web browser, including enhanced text formatting and mathematical formula support.

Part VI: WYSIWYG HTML Editors

Chapter 18, "Using Netscape Navigator Gold," discusses the Gold version of Netscape Navigator, which uses wizards, HTML templates, and other features to enable WYSIWYG creation of Web pages, without the necessity of programming directly in HTML.

Chapter 19, "Using Microsoft FrontPage," talks about the FrontPage program, which is Microsoft's entry into the arena for the easy creation and publishing of HTML Web pages
and Web sites.

Chapter 20, "Using Adobe PageMill," discusses the capabilities and use of Adobe's PageMill, which can be used to design and create HTML documents with full support for graphics, image maps, tables, and other HTML elements.

Part VII: Key HTML Issues for Webmasters

Chapter 21, "HTML Validation," discusses the tools available to validate Web pages and Web sites to help you determine how compatible your sites will be with the available Web browsers.

Chapter 22, "Key Graphics Utilities for Webmasters," discusses the graphics programs th