nd Editi - GBV · Chapter 19 ° Introducing Perl and CGI 687 Why Perl? 688 Java 688 Proprietary...
Transcript of nd Editi - GBV · Chapter 19 ° Introducing Perl and CGI 687 Why Perl? 688 Java 688 Proprietary...
SUB Gfittingen213 545 233
2001 A 9390
nd Editi
S«BEX- SAN FRANCISCO • PARIS • DUSSELDORF • SOEST •• LONDON
CONTENTSIntroduction xxiii
Part I • Introducing HTML 1
Chapter 1 a Introducing Web Pages and HTML 3
An Overview of HTML 4Viewing HTML Pages • 4HTML Elements and Tags 5The Essentials of a Web Page 6Learning HTML 8Skip the Programming: Use FrontPage Express 10
Adding Some Structure to a Page 12Using Paragraphs or Line Breaks 13Dividing Sections with a Horizontal Line 14Creating a Hierarchy with Headings 15
Formatting Text and Pages . 16Formatting Text 17Formatting Pages 18Using Styles and Style Sheets 19
Linking Pages to the World 22Creating a Text or Image Hyperlink . 22Specifying Other Link Targets 25Creating a Clickable Imagemap ' 25
Including Pictures in a Page " 28Creating Lists 29Arranging Items within Tables 31Getting Feedback with Forms . 33
Designing a Form 33Getting the Data Back to You 35
Splitting a Page into Frames . 36What's Next? . 39
Chapter 2 ° Creating Your First HTML Document 41Creating, Saving, and Viewing HTML Documents 42Applying Structure Tags 44
The<!DOCTYPE...>Tag 46
Contents xi
The<HTML>Tag 47The<HEAD>Tag 47The <TITLE> Tag 48The <B0DY> Tag 49
Applying Common Tags and Attributes 50Creating Paragraphs 50Creating Headings . 53Creating Lists 56Applying Bold, Italic, and Other Emphases 64Including Horizontal Rules 67Specifying Line Breaks 68
Including Fancier Formatting 69Adding Colors . 69Specifying Fonts and Font Sizes 73
What's Next . 75
Chapter 3 ° Stepping Out: Linking Your Wayaround the Web 77
Creating an External Link • 78Using the HREF Attribute and Anchor Text 79Creating Advisory Titles for Your Links with the
TITLE Attribute 81Labeling Sections of Your Document with the NAME Attribute 84Changing Browser Windows with the TARGET Attribute 87Using Other Anchor Attributes 88
Using Anchor Elements with Other HTML Elements 90Creating an Internal Link 94
Understanding Absolute URLs 95Understanding Relative URLs 95Using Relative URLs with Different Directories 96Using Default Pages 98
Jumping to a Named Anchor with Internal Links 99Using Named Anchor Elements with Internal Links
and Relative URLs 100Linking to Different Parts of the Same Document 101Creating a Table of Contents Using Named Anchors 102
Verifying and Maintaining Links 105Using External Link Verification Tools 107
What's Next 109
xii Contents
Chapter 4 ° Publishing Your HTML Documents 111Places to Publish 1.12
Publishing through Your ISP 112Publishing through a Corporate Server 118Publishing through Your Own Server 118
The Publishing Process 122
Uploading with FTP 123
Uploading with Other Tools 128What's Next 129
Chapter 5 D Understanding the HTML DocumentLife Cycle 131
Phase 1: Developing Documents . 132Planning Documents 134
Planning for Maintenance 138Organizing Your Documents > 139Creating Documents 143
' Testing Documents before Publication 145Phase 2: Publishing Documents 152Phase 3: Testing Published Documents ' 153Phase 4: Maintaining Documents 154
Developing a Plan 155Keeping Up 156
What's Next 157
Part I I • PLannina and DesigningYour Web Page 159
Chapter 6 D Site Design and NavigationThe Home Page As a Site Guide .
The Main Topic PageThe Subsidiary Page
Navigating through Your Site
The First Screen—The Top's Gotta Pop or
They're Not Gonna StopNavigational Tools—Graphics, Text, FramesConsistency
The TourLight Me Up! Cigar Aficionado Magazine
161165165166168
168168173175175
Contents xiii
You're Not Cool Enough. Go Away! 182Eight Miles High: United Airlines 184
• i Another Airline: Southwest Airlines 186Out-of-Place Graphics: Kenwood Home and Car Audio 189Text Is Just All Right with Me: Red Hat Software 191Bad Home-Page Design Techniques 194
Designing Your Site Using Storyboards 198Storyboard-Step One 199Storyboard-Step Two 200Storyboard—Step three 200Storyboard—Step Four 201Creating the Home Page . 202Creating the Rest of the Site • 206The Value of Organizing via Storyboards . 206
What's Next? . 207
Chapter 7 n Formatting the Body Section of Your Pages 209Using Block-Level Elements to Structure Your Documents 210
Functional and Logical Divisions 211Organizing Your Text with Lists , 230
Using Text-Level Elements 236Creating Links with the Anchor Element's <A> Tag 237Inserting Java Applets with the Applet Element. 238Specifying Default Font Information with the
Basefont Element ' 238Creating New Lines with the Line-Break Element 239Adding Graphics with the Image Element 240Making Imagemaps with the Map Element 240The Quote Element 241The Subscript Element 241The Superscript Element 241Using Other Text-Level Elements 242Changing Font Size, Face, and Color with the Font Element 243
Using Font-Style Elements 246The Bold Element 247The Italics Element 247The Underline Element , 247The Strike Element 248The Big Element 249The Smalf Element 249
xiv Contents
The Teletype Element 249
Using Phrase Elements 250\ The Acronym Element 251
The Citation Element 251The Code Element 252The Definition Element 252
The Emphasis Element , 252
The Keyboard Element • 253The Sample Element 253The Strong Element 254The Variable Element x 254
Marking Changes with the Ins and Del Elements 255What's Next? 257
Chapter 8 n Dividing a Window with Frames 259Understanding the Use of Frames 260
Knowing the Limitations of Frames 261Understanding the Advantages of Frames 263
Creating Frameset Documents 264Using the Frameset Element 265Putting Documents inside Frames with the Frame Element 273
Using Targeted Links 277Targeting Frames 277Using the Base Element to Set a Default Target 279
Using Special Target Names i 281Providing Alternate Content with the Noframes Element 284Using the Inline Frame Element to Create Inline Frames 286Unframing Pages 289What's Next 291
Chapter 9 a Layout Technology 293Standard HTML Formatting 294
Example , 308Tables 309
Rows and Columns 312Example 317
Frames 322Frame Structure 323
Contents
Elements of Framed PagesExample
What's Next?
Chapter 10 ° Adding Graphics- Adding Graphics with the Image Element
Using Image Element AttributesDescribing Images with Alternate TextPlacing Images with Alignment AttributesSizing an Image with WIDTH and HEIGHT AttributesSetting an Image's Border WidthAdding White Space with HSPACE and VSPACEUsing Other Attributes with Images
Using Images As LinksCreating Imagemaps
Understanding Imagemap TypesWorking with Image Files
Understanding Image FormatsWorking with Special Image FormatsUsing Image Tools to Create and Edit ImagesCreating ImagesUsing Existing Images
What's Next?
XV
326331339
341342343343348352355356357358360360361361364368371372375
Chapter 11 ° Presenting Information in TablesUnderstanding the Use of Tables
Understanding Table ModelsIntroducing the Simple Table Model and Its ElementsCreating an Example TableAdvantages of TablesLimitations of Tables
Creating a Table with Netscape ComposerUsing the Simple Table Model's Elements and Attributes
Defining Tables with the Table ElementUsing the Table Element's AttributesPutting All ofthe Table Element's Attributes TogetherUsing the Simple Table Model's ElementsUsing Attributes with the Simple Table Model's Elements
xvi Contents
Using HTML 4.0 Table Elements and Attributes 409Understanding the HTML 4.0 Table Model Structure 410Creating Columns and Groups of Columns 411Grouping Rows with Row Group Elements 414Using the HTML 4.0 Table Model's Attributes 416
- - Putting the HTML 4.0 Table Model to Work: A Final Example 424Using Tables As a Layout Tool 426
Creating Page Margins with Tables 426Using Tables for Navigation Bars . 428
What's Next 429
Chapter 12 n Web Typography 431Approaching Web Typography 433
Graphics and Type 434HTML and Type 435
Style Sheets and Type 438Families and Faces 440
Typefaces and Graphics 441
Typefaces, Families, and the Font Tag 442Style Sheets 443
Type Form 450Type Form and Graphics 450Type Form and HTML 451Type Form and Style Sheets , 452
Other Typographic Considerations 455
Using Graphics . 455Type Size and HTML 457
StyleSheets 459Color and Type 460
Creating Colored Type with Graphics 461HTML-Based Type and Color 461Style Sheets and Color . 462
All Together Now 462Graphic Example 462
HTML Example 469
Style Sheet Example 475What's Next? 477
Contents xvii
Part I I I • Advanced HTML
Chapter 13 ° Optimizing Your Web Pages forInternet Explorer 5
Directing Internet Explorer Users to Internet Explorer PagesAdding the Script
Optimizations for Internet Explorer 5Adding Functionality
Page LayoutHyperlink OptimizationAdding a Watermark to Your Web PageOptimizing FontsTable Optimizations
What's Next?
Chapter 14 ° Optimizing Your Pages forNetscape Navigator 4
The <LAYER> TagInserting a Web Page inside a Web PageTiling a Background Image behind ParagraphsClipping the Contents of a <LAYER> TagControlling the Position of Text and Images
on the Web PageMaking <LAYER> Content Visible or Hidden
Layout TricksPage Margins in Netscape Navigator 4Formatting Text into Columns
What's Next?
Chapter 15 ° Including MultimediaDeciding to Include Multimedia
The Challenges for VisitorsThe Challenges for Developers
Using Animated GIFsAdding Sounds
Some Disadvantages of SoundsSound File Formats
Adding VideoVideo File Formats
479
481482483485486486488493494497503
505506506509512
514519521521523527
529530530532534538539540543544
xviii Contents
Including Java Applets . 546Adding Multimedia Using HTML 4 551What's Next 557
Chapter 1 6 ° Using Style Sheets 559How Do Style Sheets Work? 560
Some Advantages of Using Style Sheets 561Implementing Style Sheets 562
Associating Style Sheets with HTML Documents 562Developing a Style Sheet 576Setting Font Properties 583Setting Text Properties 589Setting Box Properties 594Setting Color and Background Properties 597Setting Classification Properties 600Setting Aural Style Sheet Properties 601Setting Printed Media Properties 602Setting Positioning Properties 604
What's Next 605
Chapter 17 ° Developing HTML Forms 607Determining Form Content 608
Information Issues 608Usability Issues 611Design Issues . 6 1 2
Creating Forms 614Understanding Widgets • 614Creating a Form and Adding-Submit and Reset Buttons 616Including General Input Fields 622Including Text Areas 635Including Select Fields 636
Processing Forms . 640One Solution: Processing Using cgiemail 645
What's Next . 649
Chapter 18 ° Exploring and Navigating Dynamic HTML 651Setting Up 652Using DHTML in Internet Explorer 653
The Heading and the Horizontal Line 655The Hidden Message 657
Contents
The Message at the Center of the PageThe Moving Boxes
. The Changeable Box
A Word about ColorScripting the Dynamic Effects
""•"" The Whole File .Using DHTML in Navigator
The Heading and the Horizontal LineThe <LAYER> TagBack to the Heading and the Horizontal LineThe Hidden Message
The Message at the Center of the PageThe Movable BoxesThe Clickable ButtonsScripting the Dynamic Effects
The Whole FileWhat's Next?
XJX
658659663663664670673674674675676677678678679681683
Part IV • Beyond HTML 685
Chapter 19 ° Introducing Perl and CGI 687Why Perl? 688
Java 688Proprietary Languages ' . 689
CGI 690Perl's Ancient History . 691We Owe It All to Larry Wall: A History of Perl 692Perl and the World Wide Web 695
Building a Perl Script 696First Things First: Perls before Code 697Loading the Interpreter 698Running the "Hello" Example . 699How Perl Programs Run - 700
Dissecting the "Hello" Example . 702Variables, Scalars, and Lists in Perl 706
Perl Variables: What's in a Name . 706Introducing Scalars 707Perl Lists 708
xx Contents
Perl and the Common Gateway Interface 710What Is CGI, Anyway? . 713
CGI Programming Languages 715C/C++ 715Visual Basic 717Shell Languages 718Proprietary CGI Methods . 719
What's Next? 719
Chapter 20 n Introducing JavaScript and JScript 721JavaScript and Browsers, JavaScript and Servers 722Embedding JavaScript in HTML 727
Other Language Attributes 728Telling Non-JavaScript Browsers to Ignore Your Code 730The Noscript Tag , 733The Script Tag's SRC Attribute 735JavaScript Entities 736JavaScript Comments ' 737Use of the Document Head . 739
Generating HTML 741Variables-Value Storehouses 743
Types and Variables 744Types and Literal Values 744Conversion between Types ' 754The Object Type and Arrays 762Objects and the Length Property 768
Summary 769What's Next 769
Chapter 21 ° XML Introduction and History 771The Need for Context 772
Data + Context = Information 773The Birth of the Internet 774Did the Browser Wars Kill HTML? 776The Presentation Layer Breaks Loose 778
The Emergence of XML 779A Quick Lexicon 781
The Roles of XML , 785XML As a Document Format 786XML As a Document Management Format 788
• XML As a Data FormatXML As a Transformation Language
XML As a Programming Language
XML As a Multimedia FormatHow Can I Use XML?
Customizing Web Sites
Creating Components and Scripts
Managing Documents and Data SpacesE-commerceIntegrating Applications
In Summary
What's Next
Contents xxi
790794797799800802805806808809811811
Chapter 22 ° Behind the Scenes—How Active ServerPages Work 813
Introduction to ASP 815Beyond HTML ' ' 815
Enter CGI 816ISAPI and NSAPI 817
Benefits of ASP 817ASP Is Language-Independent 817ASP Is for Non-Programmers \ 818
Other Methods for Delivering Dynamic Content , 819What Is a CGI Program? . 819
What Is ISAPI? 820What Are the Advantages of ASP over HTML? . 821
What Is ASP's Competition? 821
Application Server Vendors 822JavaServer Pages 822Java 823VB IIS Applications 823
. Others (e.g., C++) 823How ASP Compares with its Competition 824
How to Use ASP 825Simple Text Processing 826Complex Decision Making 826
Intermediary between Browser and COM Components 826How Not to Use ASP 827
As Business Logic 827
xxii Contents
As Database Access Logic - 828As a Primary Means of Complex Data Processing 828
What You Can Do with ASP 828-Make If ...Then Decisions 829Process Information from Clients 830Access Databases, and Files 830Format Responses 830
Launch and Communicate with COM Objects ' 831Control Transactions 831
How Web Requests Work . 832How a Client Requests Content 834What the Server Does with the Request 835How the Server Responds ' 837What the Client Does with the Response , 838
How ASP Requests Differ from HTM Requests " 840Whatlstheasp.dl l? 842What Is Script? 842How Does the Server Separate Script from Content? 844
- How/When Does the Server Process Script? 845How Does the Browser Act with ASP Sites? . 845
What's Next 845
Chapter 23 ° Introduction to XHTML 847What Is XHTML? ; 848
How Is XHTML Different from HTML? 850Element Minimization 850Empty Elements 851Boolean Attributes 852Ampersands in Attribute Values 853Case Sensitivity 853
Implementing XHTML .854
Who Should Use XHTML? 855Learning More about XHTML 856What's Next 856
Appendix ° HTML Master's Reference 861
Index , . . 967