1. Trang chủ
  2. » Công Nghệ Thông Tin

Dreamweaver CS4 the missing manual

1,1K 605 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1.089
Dung lượng 24,95 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Recent and upcoming titles include: Access 2007: The Missing Manual by Matthew MacDonald AppleScript: The Missing Manual by Adam Goldstein AppleWorks 6: The Missing Manual by Jim Elferdi

Trang 5

THE MISSING

Dreamweaver CS4

David Sawyer McFarland

Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo

Trang 6

Dreamweaver CS4: The Missing Manual

by David Sawyer McFarland

Copyright © 2009 O’Reilly Media, Inc All rights reserved.

Printed in the United States of America.

Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales promotional use Online editions are

also available for most titles (safari.oreilly.com) For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com.

Printing History:

November 2008: First Edition.

Nutshell Handbook, the Nutshell Handbook logo, the O’Reilly logo, and “The book that should have been

in the box” are registered trademarks of O’Reilly Media, Inc Dreamweaver CS4: The Missing Manual, The

Missing Manual logo, Pogue Press, and the Pogue Press logo are trademarks of O’Reilly Media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O’Reilly Media, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps.

While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

ISBN: 978-0-596-52292-6

Trang 7

Table of Contents

The Missing Credits xix

Introduction 1

Part One: Building a Web Page Chapter 1: Dreamweaver CS4 Guided Tour 21

The Dreamweaver CS4 Interface 21

The Document Window 22

The Insert Panel 26

The Files Panel 28

The Property Inspector 30

The Application Bar 30

Organizing Your Workspace 32

Setting Up a Site 37

The Site Definition Wizard 38

Defining a Site the Fast Way 42

Creating a Web Page 44

The Dreamweaver Test Drive 47

Phase 1: Getting Dreamweaver in Shape 48

Phase 2: Creating a Web Site 52

Phase 3: Creating and Saving a Web Page 53

Phase 4: Adding Images and Text 58

Phase 5: Preview Your Work 65

Phase 6: Finishing the Page 67

Trang 8

Chapter 2: Adding Text to Your Web Pages 73

Adding Text in Dreamweaver 73

Adding Special Characters 74

Line Breaks 75

Nonbreaking Spaces 77

Multiple Spaces 77

Adding a Date to Your Page 78

Copying and Pasting Text 79

Simple Copy and Paste 79

Paste Special 80

Pasting Text from Word: The Basic Method 82

Pasting Text with Word Formatting 83

Pasting Excel Spreadsheet Information 84

Importing Word and Excel Documents (Windows) 85

Selecting Text 85

Spell Checking 87

About Dictionaries 88

Performing the Check 88

Undo, Redo, and the History Panel 90

Undo 90

History Panel 90

Chapter 3: Text Formatting 93

Paragraph Formatting 95

Paragraphs 95

Headlines 97

Preformatted Text 97

Paragraph Alignment 98

Indented Paragraphs 99

Creating and Formatting Lists 100

Bulleted and Numbered Lists 100

Reformatting Bulleted and Numbered Lists 102

Definition Lists 105

Removing and Deleting List Items 106

Text Styles 107

Chapter 4: Introducing Cascading Style Sheets 111

Cascading Style Sheet Basics 112

Why Use CSS? 112

Internal vs External Style Sheets 113

Types of Styles 114

Creating Styles 115

Phase 1: Set Up the CSS Type 115

Phase 2: Defining the Style 119

Creating a Style with the Property Inspector 119

Trang 9

Using Styles 122

Applying a Class Style 122

Removing a Class Style 124

Applying IDs to a Tag 124

Linking to an External Style Sheet 125

Manipulating Styles 126

Editing Styles 126

Deleting a Style 127

Renaming a Class Style 128

Duplicating a Style 130

Checking Browser Compatibility 130

Text Formatting with CSS 133

Choosing a Font 134

Changing the Font Size 137

Picking a Font Color 140

Adding Bold and Italics 140

Aligning Text 141

CSS Type Properties in the Rule Definition Window 141

Block Properties 143

List Properties 146

Cascading Style Sheets Tutorial 148

Setting Up 148

Creating an External Style Sheet 149

Editing a Style 151

Adding Another Style 153

Creating a Class Style 156

Attaching an External Style Sheet 158

Chapter 5: Links 161

Understanding Links 161

Absolute Links 162

Document-Relative Links 162

Root-Relative Links 163

Link Types in Action 165

Executive Summary 167

Adding a Link 167

Browsing for a File 167

Using the Point-to-File Tool 170

Typing (or Pasting) the URL or Path 171

Using the Hyperlink Object 172

Adding an Email Link 175

Linking Within a Web Page 176

Method 1: Creating a Named Anchor 177

Method 2: Adding an ID 178

Linking to an Anchor or ID 179

Viewing and Hiding Anchors 179

Trang 10

Modifying a Link 180

Changing a Link’s Destination 180

Removing a Link 180

Styling Links 181

CSS and Links 182

Creating a Navigation Menu 184

Adding a Menu 185

Adding, Editing, and Removing Links 186

Changing the Look of the Menu 188

Link Tutorial 195

Linking to Other Pages and Web Sites 195

Formatting Links 197

Adding a Navigation Bar 199

Styling the Menu Bar 203

Submenus and Rollover Buttons 208

Chapter 6: Images 213

Adding Images 213

Adding an Image Placeholder 216

Inserting an Image from Photoshop 217

Method 1: Using the Insert Image Object 219

Method 2: Copying and Pasting from Photoshop 224

Modifying an Image 224

Adding an ID to an Image 225

Adding a Text Description to an Image 225

Changing an Image’s Size 227

Some Properties to Avoid 227

Controlling Images with CSS 229

Wrapping Text Around an Image 229

Adding Borders 231

Background Images 233

Editing Graphics 236

The Built-In Editing Tools 236

Setting Up an External Editor 239

Editing Smart Objects 241

Editing Images Pasted from Photoshop 244

Optimizing an Image 245

Image Maps 245

Editing a Hotspot’s Properties 248

Rollover Images 248

Tutorial: Inserting and Formatting Graphics 251

Setting Up 251

Adding an Image 251

Inserting a Photoshop File 253

Inserting a Rollover Image 257

Using Background Images 259

Trang 11

Chapter 7: Tables 263

Table Basics 264

Inserting a Table 265

Selecting Parts of a Table 268

Selecting a Table 268

Selecting Rows or Columns 268

Selecting Cells 269

Expanded Table Mode 269

Formatting Tables 270

Aligning Tables 270

Clearing Height and Width Values 271

Resizing a Table 272

Modifying Cell and Row Properties 273

Alignment Properties 273

Table Header 274

A Property to Forget 274

Cell Decoration 275

Setting Cell Dimensions 276

Tips for Surviving Table Making 276

Adding and Removing Cells 278

Adding One Row or Column 278

Adding Multiple Rows or Columns 279

Deleting Rows and Columns 280

Merging and Splitting Cells 280

Tabular Data 282

Importing Data into a Table 282

Sorting Data in a Table 284

Exporting Table Data 286

Tables Tutorial 286

Adding a Table and Data 287

Modifying the Table 289

Formatting the Table 290

Final Improvements 294

Part Two: Building a Better Web Page Chapter 8: Advanced CSS 299

Compound Selectors 299

Descendent Selectors 301

Styling Groups of Tags 304

Fast Style Editing with the Properties Pane 305

Moving and Managing Styles 308

More About CSS 311

Inheritance 312

The Cascade 314

The Other Side of the CSS Styles Panel 315

Trang 12

Using the Code Navigator 320

Styling for Print 322

Previewing Media Styles in Dreamweaver 324

Tips for Printer Style Sheets 325

Chapter 9: Page Layout 329

Types of Web Page Layouts 331

Float Layout Basics 332

The Mighty <div> Tag 333

The Insert Div Tag Tool 335

A Simple Example 337

Understanding the Box Model 341

Dreamweaver’s CSS Layouts 345

The Structure of Dreamweaver’s CSS Layouts 350

Modifying Dreamweaver’s CSS Layouts 352

Making General Changes 352

Modifying Fixed Layouts 355

Modifying Liquid Layouts 357

Modifying Elastic Layouts 357

Absolute Positioning 358

The CSS Positioning Properties 358

Adding an AP Div to Your Page 366

Drawing AP Divs 369

The AP Elements Panel 370

Modifying AP Element Properties 371

Resizing Absolutely Positioned Elements 372

Moving AP Elements 372

Aligning AP Elements 373

Background Image and Color 374

Nesting AP Divs 374

CSS Layout Tutorial 375

Adding Content 379

Fine-Tuning the Layout 380

Adding Styles and Navigation 383

Fiddling with the Footer 386

Chapter 10: Under the Hood: HTML 391

Roundtrip HTML 391

Auto-Fixing Your Code 392

Web Application Server Pages 393

Special Characters and Encoding 394

Code View 395

Coding Toolbar 400

Code Hints 402

Code Collapse 404

Setting Code Formatting 406

Trang 13

Live Code 412

Quick Tag Editor 413

Using the Quick Tag Editor 414

Tag Inspector 415

Comparing Versions of a Web Page 416

Using WinMerge to Compare Files 419

Using Text Wrangler to Compare Files 421

Reference Panel 422

Inserting JavaScript 424

Part Three: Bringing Your Pages to Life Chapter 11: Forms 429

Form Basics 429

The Code Backstage 430

Creating a Form 431

Adding Form Elements 435

What All Form Elements Have in Common 435

Text Fields 439

Checkboxes and Checkbox Groups 442

Radio Buttons and Radio Groups 445

Pull-Down Menus and Lists 446

File Field 449

Hidden Field 450

Buttons 451

<label> Tag 453

<fieldset> Tag 453

Validating Forms 454

Spry Validation Basics 455

Formatting Spry Error Messages and Fields 460

Spry Text Field 462

Spry Text Area 468

Spry Checkbox 470

Spry Select 473

Spry Password 474

Spry Confirm 476

Spry Radio Group 476

Forms Tutorial 477

Inserting a Form and Adding a Form Field 478

Adding a Spry Validation Text Field 483

Adding a Spry Form Menu 486

Adding a Spry Radio Group 489

Completing and Testing the Form 491

Trang 14

Chapter 12: Spry: Creating Interactive Web Pages 493

What is Spry? 493

Tabbed Panels 494

Adding a Tabbed Panel 495

Adding and Editing Panel Content 497

Formatting Tabbed Panels 498

Accordions 501

Adding an Accordion 502

Adding and Editing Accordion Content 503

Formatting a Spry Accordion 504

Collapsible Panels 508

Adding a Collapsible Panel 508

Adding Content to a Collapsible Panel 510

Formatting a Collapsible Panel 511

Spry Tooltips 513

Adding a Spry Tooltip 513

Adding Content to a Tooltip 517

Formatting a Tooltip 518

Spry Data Sets 518

Storing Data in an HTML File 520

Storing Data in an XML File 522

Inserting a Spry Data Set 527

Inserting HTML Data 529

Inserting XML Data 534

Choosing a Data Layout 536

Creating a Spry Region 545

The Bindings Panel 548

Spry Repeating Region 549

Spry Repeat Lists 551

Live View 553

Chapter 13: Dreamweaver Behaviors 555

Understanding Behaviors 556

Behavior Elements 556

More About Events 556

Applying Behaviors 557

The Behaviors Panel 557

Applying Behaviors, Step by Step 559

Adding Multiple Behaviors 561

Editing Behaviors 562

A Quick Example 562

Events 563

Mouse Events 563

Keyboard Events 565

Body and Frameset Events 566

Selection and Highlighting Events 566

Trang 15

The Actions, One by One 567

Spry Effects 568

Navigation Actions 575

Image Actions 582

Message Actions 586

Element Actions 589

Advanced Behaviors 592

Call JavaScript 592

Change Property 593

Adding More Behaviors 594

Chapter 14: Flash and Other Multimedia 595

Flash: An Introduction 596

Inserting a Flash Movie 597

Flash Movie Properties 599

Making It Easier to Download the Flash Plug-in 603

Adding Flash Videos 604

The Land of Obsolete Web Technology 608

Part Four: Building a Web Site Chapter 15: Introducing Site Management 613

Structuring a Web Site 614

Defining a Site 618

Editing or Removing Defined Sites 622

Exporting and Importing Sites 623

Organizing Site Files 625

Modifying the Files Panel View 627

Adding New Folders and Files 628

Site Assets 633

Viewing the Assets Panel 634

Inserting Assets 636

Favorite Assets 637

Chapter 16: Testing Your Site 641

Site Launch Checklist 641

Find and Fix Broken Links 643

Finding Broken Links 644

Fixing Broken Links 646

Listing External Links 647

Orphaned Files 648

Changing a Link Throughout a Site 650

Validating Web Pages 651

Steps for Validating Web Pages 652

Cleaning Up HTML (and XHTML) 654

Trang 16

Site Reporting 657

Accessibility 660

Accessibility Priorities 663

Accessibility Options 664

Download Statistics 665

Chapter 17: Moving Your Site to the Internet 667

Defining a Remote Site 668

Setting Up a Remote Site with FTP 669

Setting Up a Remote Site over a Local Network 673

Setting Up a Remote Site with RDS 674

Setting Up a Remote Site with WebDAV 675

Setting Up a Remote Site with SourceSafe 677

Transferring Files 678

Moving Files to the Web Server 678

Getting Files from the Web Server 682

Cloaking Files 684

Check In and Check Out 686

Checking Out Files 688

Checking In Files 691

Synchronizing Site Files 693

Communicating with Design Notes 696

Setting Up Design Notes 697

Adding Design Notes to a File 698

Viewing Design Notes 699

Organizing the Columns in the Files Panel 699

“All Info” Design Notes in Column Views 701

Part Five: Dreamweaver CS4 Power Chapter 18: Snippets and Libraries 707

Snippets Basics 707

Using Snippets 708

Creating Snippets 710

Organizing Snippets 711

Built-In Snippets 712

Library Basics 713

Creating and Using Library Items 714

Adding Library Items to a Page 716

Editing Library Items 717

Renaming Library Elements 719

Deleting Library Elements 719

Snippets and Library Tutorial 719

Creating a Snippet 720

Creating a Library Item 723

Trang 17

Chapter 19: Templates 727

Template Basics 727

Creating a Template 730

Turning a Web Page into a Template 730

Building a Template from Scratch 732

Defining Editable Regions 732

Adding a Basic Editable Region 733

Adding a Repeating Region 736

Repeating Tables 738

Making a Tag Attribute Editable 741

Adding Optional Regions 744

Locking Optional Regions 745

Repeating Optional Regions 746

Optional Editable Regions 746

Advanced Optional Regions 746

Editing and Removing Optional Regions 750

Nested Templates 751

Customizing Nested Templates 754

Using Nested Templates 755

Building Pages Based on a Template 756

Working with Repeating Regions 756

Changing Properties of Editable Tag Attributes 757

Hiding and Showing Optional Regions 758

Applying Templates to Existing Pages 758

Updating a Template 761

Updating Nested Templates 762

Unlinking a Page from a Template 763

Exporting a Template-Based Site 764

Template Tutorial 765

Creating a Template 765

Creating a Page Based on a Template 769

Creating Another Template-Based Page 773

Updating a Template 774

Chapter 20: Automating Dreamweaver 777

The History Panel Revisited 777

Replay Your Steps 778

Exceptions and Errors 779

Copying and Pasting Actions 779

Save Steps as Commands 780

Recording Commands 781

Find and Replace 782

Find and Replace Basics 783

Basic Text and HTML Searches 783

Advanced Text Searches 788

Advanced Tag Searches 792

A Powerful Example: Adding Alt Text Fast 794

Trang 18

Chapter 21: Customizing Dreamweaver 799

Keyboard Shortcuts 799

Make Your Own Shortcut Set 800

Changing Keyboard Shortcuts 801

Create a Shortcut Cheat Sheet 804

Dreamweaver Extensions 804

Browse the Exchange 805

Find a Good Extension 807

Other Extension Sources 808

Download and Install Extensions 808

Extension Manager 809

Make Your Own Extensions 810

Part Six: Dynamic Dreamweaver Chapter 22: Getting Started with Dynamic Web Sites 815

Pieces of the Puzzle 817

Understanding Server Models 818

Picking a Server Model 821

Dynamic Web Sites: The Setup 821

Setting Up a Testing Server 822

Localhost and the htdocs Folder 823

Setting Up Dreamweaver 824

Creating a Dynamic Page 828

Databases: A Quick Introduction 829

Tables and Records 830

Relational Databases 831

Loading a Database 833

Connecting to a Database 838

Exploring the Databases Panel 841

Chapter 23: Adding Dynamic Data to Your Pages 843

Retrieving Information 843

Understanding Recordsets 843

Creating Recordsets 844

Filtering Information 847

Comparison Operators for Filters 849

Getting Comparison Values 850

Advanced Recordsets and SQL 855

Reusing Recordsets 861

Editing Recordsets 861

Deleting Recordsets 862

Adding Dynamic Information 862

The Bindings Panel 864

Formatting Dynamic Information 864

Deleting Dynamic Information 866

Trang 19

Displaying Multiple Records 866

Creating a Repeating Table 866

Creating a Repeat Region 868

Editing and Removing a Repeat Region 870

Recordset Navigation 870

Recordset Navigation Bar 871

Recordset Navigation Status 873

Viewing Live Data 875

Live Data View Settings 876

Master Detail Page Set 879

Passing Information Between Pages 882

Tutorial: Displaying Database Info 884

Creating a Recordset 885

Live Data View and Creating Repeating Regions 887

Editing a Recordset and Linking to a Detail Page 889

Building the Detailed Product Page 893

Filling in the Details 896

Operators Standing By 900

Chapter 24: Web Pages That Manipulate Database Records 905

Adding Data 905

Dreamweaver’s Record Insertion Form Wizard 906

Using the Insert Record Behavior 910

Updating Database Records 912

The Update Record Form Wizard 913

The Update Record Server Behavior 916

Dynamic Form Fields 920

Dynamic Text Form Fields 921

Dynamic Checkboxes and Radio Buttons 922

Dynamic Menus and Lists 925

Deleting Records 927

Deleting Records for ASP 928

Deleting Records for PHP and ColdFusion 929

Tutorial: Inserting and Updating Data 932

Adding an Insert Product Page 932

Finishing the Insert Form 939

Building a Page for Editing Database Records 940

Creating and Linking to the Delete Page 948

Chapter 25: Advanced Dynamic Site Features 953

Password-Protecting Web Pages 953

The Users Table 954

Creating a Registration Form 954

Creating the Login Page 957

The Log Out User Behavior 960

Protecting Individual Pages 962

Trang 20

Additional Data Sources 963

For PHP and ColdFusion 964

For ASP 965

URL Variables 966

Form Variables 966

Cookies 967

Session Variables 968

Server Variables 970

Advanced Server Behaviors 972

Recordset Paging 972

Show Region Server Behaviors 974

Tutorial: Authentication 977

Building a Login Page 977

Password-Protecting the Administration Pages 981

Displaying a Portion of a Page to Logged-In Users 984

Chapter 26: Server-Side XML and XSLT 987

Understanding the Technologies 988

Creating Dynamic Pages with XSLT and XML 989

Inserting and Formatting XML 992

Inserting a Repeat Region 996

Inserting a Conditional Region 1001

Using Multiple Conditional Regions 1003

Advanced XSLT Tricks 1005

Sorting Data in a Repeat Region 1005

Using XSLT Parameters 1006

Part Seven: Appendixes Appendix A: Getting Help 1013

Appendix B: Dreamweaver CS4, Menu by Menu 1017

Index 1039

Trang 21

The Missing Credits

About the Author

David Sawyer McFarland is president of Sawyer McFarland Media,

Inc., a Web development and training company in Portland,

Ore-gon He’s been building Web sites since 1995, when he designed his

first Web site: an online magazine for communication

profession-als He’s served as the Webmaster at the University of California at

Berkeley and the Berkeley Multimedia Research Center, and he has

helped build, design, and program numerous Web sites for clients

including Macworld.com, among others

In addition to building Web sites, David is also a writer, trainer, and instructor

He’s taught Dreamweaver at the UC Berkeley Graduate School of Journalism, the

Center for Electronic Art, the Academy of Art College, Ex’Pressions Center for

New Media, and the Art Institute of Portland He currently teaches in the

Multi-media Program at Portland State University He’s written articles about

Dream-weaver and the Web for Practical Web Design, MX Developer’s Journal, Macworld

magazine and CreativePro.com

David is also the author of CSS: The Missing Manual, and JavaScript: The Missing

Manual.

David has used Dreamweaver since version 2, and has been a member of the

Dreamweaver Advisory Council He welcomes feedback about this book by email:

missing@sawmac.com (If you’re seeking technical help, however, please refer to the

sources listed in Appendix Getting Help.)

About the Creative Team

Peter Meyers (editor) is the managing editor of O’Reilly Media’s Missing Manual

series He lives with his wife, daughter, and cats in New York City Email:

meyers@oreilly.com.

Sohaila Abdulali (copy editor) is a freelance writer and editor She has published a

novel, several children’s books, and numerous short stories and articles She

recently finished an ethnography of an aboriginal Indian woman She lives in New

York City with her husband Tom and their small but larger-than-life daughter,

Samara She can be reached through her Web site at www.sohailaink.com.

Nellie McKesson (production editor) lives in Jamaica Plain, Mass., and spends her

spare time making t-shirts for her friends to wear (mattsaundersbynellie.etsy.com),

and playing music with her band (myspace.com/drmrsvandertrampp) Email:

nellie@oreilly.com.

Trang 22

xx Dreamweaver CS4: The Missing Manual

Ron Strauss (indexer) is a full-time freelance indexer specializing in information

technology When not working, he moonlights as a concert violist and alternative

medicine health consultant Email: rstrauss@mchsi.com.

Deborah Pang Davis (Chia Vet Web site designer) created Cococello, a print and

Web design boutique in beautiful Portland, Oregon Before launching Cococello,she had the privilege of working at, among others, National Geographic Traveler,The Chicago Tribune, Toronto’s Globe and Mail, and The Seattle Times She knewearly on that life for her never included pantyhose or the pantsuit She can be

reached through her Web site at www.cococello.com.

John C Bland II (technical reviewer) is co-founder of Katapult Media Inc (www.

katapultmedia.com) which focuses on software and Web development using

tech-nologies such as ColdFusion, the Flash platform, PHP, Java, and the NET form Through Katapult, he works diligently on custom software and Webproducts As the manager of the Arizona Flash Platform User Group, John contin-ues to put back into the community which helped mold him into the developer he

plat-is today John blogs regularly on hplat-is blog: Geek Life (www.johncblandii.com).

Murray Summers (technical reviewer), a biochemist by training, has spent the last

20 years working in the computer industry In 1998, Murray started his Web site

production company, Great Web Sights (www.great-web-sights.com) He’s an

Adobe Community Expert, and previously a Team Macromedia member, a romedia Certified Web Site Developer, and Dreamweaver Developer Murray hasalso contributed chapters and authored books about Web development

Mac-Acknowledgements

Many thanks to all those who helped with this book, including Deb Pang Davis,the design mastermind behind ChiaVet.com, and my technical editor, MurraySummers, whose prolific critiques have provided a comfortable safety net to pro-tect me from any embarrassing gaffes Thanks also to my students who’ve helped

me understand Dreamweaver better and always seem to come up with at least onequestion that I have no answer for

Finally, thanks to David Pogue whose unflagging enthusiasm and boundless energynever fails to inspire; to my editor, Peter Meyers, who has helped make my wordssharper and my writing clearer (and who also has had to endure long weekends ofwork to make sure this book got finished on time); to my wife, Scholle, for beingsuch a strong supporter of my writing and a wonderful partner in my life; mymom and Doug; Mary, David, Marisa and Tessa; Phyllis and Les; my son, Gra-

ham, who has taught me that robots, spaceships, Star Wars, and Legos are much

more important than writing books; and to my daughter, Kate, who helped themost by graciously agreeing to sleep through the night while I was writing thisbook

—David Sawyer McFarland

Trang 23

The Missing Credits xxi

The Missing Manual Series

Missing Manuals are witty, superbly written guides to computer products that

don’t come with printed manuals (which is just about all of them) Each book

fea-tures a handcrafted index and cross-references to specific pages (not just chapters)

Recent and upcoming titles include:

Access 2007: The Missing Manual by Matthew MacDonald

AppleScript: The Missing Manual by Adam Goldstein

AppleWorks 6: The Missing Manual by Jim Elferdink and David Reynolds

CSS: The Missing Manual by David Sawyer McFarland

Creating a Web Site: The Missing Manual, Second Edition by Matthew MacDonald

David Pogue’s Digital Photography: The Missing Manual by David Pogue

Dreamweaver CS3: The Missing Manual by David Sawyer McFarland

eBay: The Missing Manual by Nancy Conner

Excel 2003: The Missing Manual by Matthew MacDonald

Excel 2007: The Missing Manual by Matthew MacDonald

Facebook: The Missing Manual by E.A Vander Veer

FileMaker Pro 8: The Missing Manual by Geoff Coffey and Susan Prosser

FileMaker Pro 9: The Missing Manual by Geoff Coffey and Susan Prosser

Flash CS3: The Missing Manual by E.A Vander Veer and Chris Grover

Flash CS4: The Missing Manual by Chris Grover

FrontPage 2003: The Missing Manual by Jessica Mantaro

Google Apps: The Missing Manual by Nancy Conner

The Internet: The Missing Manual by David Pogue and J.D Biersdorfer

iMovie 6 & iDVD: The Missing Manual by David Pogue

iMovie ’08 & iDVD: The Missing Manual by David Pogue

iPhone: The Missing Manual by David Pogue

iPhoto ’08: The Missing Manual by David Pogue

iPod: The Missing Manual, Seventh Edition by J.D Biersdorfer

JavaScript: The Missing Manual by David Sawyer McFarland

Mac OS X: The Missing Manual, Tiger Edition by David Pogue

Mac OS X: The Missing Manual, Leopard Edition by David Pogue

Trang 24

xxii Dreamweaver CS4: The Missing Manual

Microsoft Project 2007: The Missing Manual by Bonnie Biafore Office 2004 for Macintosh: The Missing Manual by Mark H Walker and Franklin

QuickBase: The Missing Manual by Nancy Conner QuickBooks 2008: The Missing Manual by Bonnie Biafore QuickBooks 2009: The Missing Manual by Bonnie Biafore Quicken 2008: The Missing Manual by Bonnie Biafore Quicken 2009: The Missing Manual by Bonnie Biafore Switching to the Mac: The Missing Manual, Tiger Edition by David Pogue and

Zacker, and Linda Zacker

Windows Vista: The Missing Manual by David Pogue Windows Vista for Starters: The Missing Manual by David Pogue Word 2007: The Missing Manual by Chris Grover

Your Brain: The Missing Manual by Matthew MacDonald

Trang 25

The World Wide Web continues to evolve, growing in scope and complexity, with

new features popping up every year to make the Web look and work better Even

people building personal Web sites now use various programming languages and

server technologies to dish up content Throughout its history, Dreamweaver has

managed to keep pace with this changing landscape with each new version

Dreamweaver CS4 is no exception: It’s capable of doing more than any previous

version Whether you’re creating database-enabled PHP pages, adding your

favor-ite sfavor-ite’s XML-based news feeds directly to your home page, using Cascading Style

Sheets (CSS) for cutting-edge design effects, dipping into the dynamic world of

JavaScript and AJAX, or simply sticking to straightforward HTML pages,

Dream-weaver has just about all the tools you need

Any enterprising designer can create Web pages, Cascading Style Sheets, and even

JavaScript programs with a simple text editor In fact, Dreamweaver CS4 provides

powerful text-editing abilities for creating basic text files or complex

database-driven Web pages But why go to all that trouble when Dreamweaver’s visual

page-building approach makes your job of creating beautiful and complex Web

sites so much easier? Whether you’re new to building Web pages or a hard-core,

hand-coding HTML jockey, Dreamweaver is a powerful tool that lets you build

Web sites quickly and efficiently, without compromising the quality of your code

What Dreamweaver Is All About

Dreamweaver is a complete Web site production and management program It

works with Web technologies like HTML, XHTML, CSS, and JavaScript

Trang 26

The enhancements in the latest version, in fact, make it easier than ever to designand lay out Web sites Cascading Style Sheet support lets you access the latest Webtechniques for creating fast-loading, easily modified Web page designs; while the

“Spry” technology provides one-click access to complex, interactive layout optionslike drop-down menus Dreamweaver also includes plenty of tools for managingWeb sites once you’ve built them You can check for broken links, use templates tostreamline site-wide page changes, and reorganize your site in a flash with the pro-gram’s site management tools

Note: Get used to the acronym CSS, which you’ll encounter frequently in this book It stands for

Cascad-ing Style Sheets, a formattCascad-ing language used to design HTML Web pages Dreamweaver CS4 continues to integrate advanced CSS creation, testing, and editing tools into Dreamweaver.

It’s also a serious tool for creating dynamic (database-driven) Web sites You can

now turn your company’s database of products into an easily updated onlinecatalog—or turn that cherished recipe collection into an online culinary resourcefor an adoring public You can even create Web pages for updating and deletingdatabase records, meanwhile keeping designated areas of your site secure fromunauthorized visitors Best of all, Dreamweaver CS4 does the programming foryou

If you’ve never used Dreamweaver before, but have already built one or more Websites, you won’t have to start from scratch Dreamweaver happily opens Web pagesand Web sites that were created in other programs without destroying any of yourcarefully handcrafted code

Why Dreamweaver?

There are other Web design programs—dozens of them, in fact But Dreamweaverhas become one of the leading programs thanks to key benefits like these:

• Visual page building If you’ve spent any time using a text editor to punch out

the HTML code for your Web pages, you know the tedium involved in addingeven a simple item like a photograph to a Web page When your boss asks you

to add her photo to the company home page, you launch your trusty text

edi-tor and type something like this: <img src="images/staff/bigcheese.jpg"

width="100" height="150" alt="The Boss">.

Not only is this approach prone to typos, but it also separates you from what

you want the page to look like.

Dreamweaver, on the other hand, takes a visual approach to building Web

pages If you put an image on your page, Dreamweaver shows you the picture

on the screen As in a word processor, which displays documents onscreen asthey look when printed, Dreamweaver provides a very close approximation ofwhat your Web page will look like in a Web browser

Trang 27

• Complex interactivity, simply You’ve probably seen Web pages where an

image (on a navigation bar, for example) lights up or changes appearance when

you move your mouse over it

Dynamic effects like this—mouse rollovers, alert boxes, and navigational

pop-up menus—usually require programming in JavaScript, a programming language

that most Web browsers understand While JavaScript can do amazing things, it

requires time and practice to learn

Dreamweaver CS4 includes an easy to use and innovative JavaScript-based

tech-nology called Spry With Spry, you can easily create interactive, drop-down

menus (Chapter 5), add advanced layout elements like tabbed panels

(Chapter 12), and add sophisticated form validation to prevent visitors to your

site from submitting forms without providing the proper information

(Chapter 11)

• Solid code Every now and then, even in Dreamweaver, you may sometimes

want to put aside the visual view and look at the underlying HTML code of a

page You may want to tweak the HTML that Dreamweaver produces, for

example, or you may be a long-time HTML hand-coder wondering what

Dreamweaver offers you

Adobe realized that many professional Web developers still do a lot of work “in

the trenches,” typing HTML, CSS and JavaScript code by hand In

Dream-weaver, you can edit the raw HTML to your heart’s content Switching back and

forth between the visual mode—called Design view—and Code view is

seam-less and, best of all, nondestructive Unlike many visual Web page programs,

where making a change in the visual design mode stomps all over the

underly-ing HTML code, Dreamweaver respects hand-typed code and doesn’t try to

rewrite it (unless you ask it to)

You can even use “Split view” to see your HTML code side-by-side with a visual

representation of your page This lets you work in either Code or Design view,

without missing a beat as you switch between the two In addition,

Dream-weaver can open many other types of files commonly used in Web sites, such as

external JavaScript files (.js files), so you don’t have to switch to another

pro-gram to work on them Dreamweaver CS4 also introduces a new “related files”

toolbar which lists all JavaScript, CSS, or server-side files used by the current

document For hand-coders this means that editing a page’s CSS or JavaScript is

just a click away (instead of a time-draining File➝Open hunt around for that

danged file) Chapter 10 has the full scoop on how Dreamweaver handles

writ-ing and editwrit-ing code

• Site management tools Rarely will you build just a single Web page More

often, you’ll be creating and editing pages that work together to form part of a

Web site Or you may be building an entire Web site from scratch

Trang 28

Either way, Dreamweaver’s site management tools make your job of dealingwith site development easier From managing links, images, pages, and othermedia to working with a team of people and moving your site onto a Webserver, Dreamweaver automates many of the routine tasks every Webmasterfaces Part 4 of this book looks at how Dreamweaver can help you build andmaintain Web sites

• Database-driven Web sites Data makes the world go round Whether you’re a

human-resource records manager or a high school teacher, you probably keeptrack of a lot of information Today, companies and individuals store reams ofinformation in database systems like Microsoft Access or Oracle 10g Dream-weaver CS4 can help you bring that information to life on the Web withouthaving to learn a lot of programming along the way From accessing informa-tion—such as the latest items in your company’s product catalog—to updatingand editing databases online, Dreamweaver CS4 can help you build database-driven Web sites Part 6 of this book offers a gentle introduction to buildingdynamic Web sites

UP TO SPEED

Hand Coding vs WYSIWYG Editors

Creating Web pages in a text editor was long considered the

best method of building Web sites The precise control over

HTML available when code is written by hand was (and

often still is) seen as the only way to assure quality Web

pages.

Hand coding’s reputation as the only way to go for pros is

fueled by the behavior of many visual page-building

pro-grams that add unnecessary code to pages—code that

affects how a page appears and how quickly it downloads

over the Internet.

But hand coding is time-consuming and error-prone One

typo can render a Web page useless.

Fortunately, Dreamweaver brings solid code writing to a

visual environment Since its earliest incarnation,

Dream-weaver has prided itself on its ability to produce clean

HTML and its tolerance of code created by other

pro-grams—including text editors In fact, Dreamweaver

includes a powerful built-in text-editing mode that lets you

freely manipulate the HTML of a page—or any other code,

including JavaScript, Visual Basic, XML, PHP, or ColdFusion

Markup Language.

But the real story is that the code produced when working

in the visual mode is as solid and well written as hand ing Knowing this, you should feel free to take advantage of the increased productivity that Dreamweaver’s visual- editing mode brings to your day-to-day work with its one- click objects, instant JavaScript, and simplified layout tools Doing so won’t compromise your code, and will certainly let you finish your next Web site in record time.

cod-Besides, no Web design program is really WYSIWYG (what you see is what you get) Because every browser interprets the HTML language slightly differently, Web design is more like WYSIRWYGOAGD: what you see is roughly what you’ll get, on a good day.

Finally, if you have experience hand-coding HTML and CSS, you’ll be pleasantly surprised by the powerful text-editing capabilities of Dreamweaver CS4 In fact, even though Dreamweaver has developed a reputation as avisual Web

page editor, it’s also one of the best text-editing programs

on the market Many of the improvements made in weaver CS4 are aimed specifically at people who spend time looking at the raw HTML, CSS, and JavaScript code on

Dream-a Web pDream-age.

Trang 29

• Have it your way As if Dreamweaver didn’t have enough going for it, the

engi-neers at Adobe have created a software product that is completely customizable,

or, as they call it, extensible Anyone can add to or change the menus,

com-mands, objects, and windows in the program

Suppose, for example, that you hardly ever use any of the commands in the Edit

menu By editing one text file in the Dreamweaver Configuration folder, you

can get rid of any unwanted menu items—or even add new commands of your

own creation This incredible flexibility lets you customize the program to fit

your work methods, and even add features that Adobe’s programmers never

imagined Best of all, the Adobe Exchange Web site includes hundreds of free

and commercial extensions to download and add to Dreamweaver See

Chapter 21 for details

Dreamwever CS4 also sports a completely new interface that lets you configure

the program’s many panels, toolbars, and inspectors in nearly an unlimited

number of ways—all of which ensures that the program fits nearly every screen

size available and conforms to just about every Web design workflow

• Part of the Creative Suite Since Adobe purchased Macromedia (the original

creator of Dreamweaver), Web designers now have access to a much larger

fam-ily of design tools including Adobe Photoshop and Illustrator Ultimately all

these Adobe programs will work together seamlessly and share a common

appearance Dreamweaver CS4 now sports the same interface as the rest of the

Creative Suite, so if you’re a long time Photoshop or Illustrator user, you’ll feel

at home with the revamped design In addition, Dreamweaver CS4 expands on

the Photoshop integration added in the last version of Dreamweaver Now, you

can use Adobe’s “Smart Object” technology to keep your site’s graphics in sync

with any changes you make to an original Photoshop file (see page 217)

What’s New in Dreamweaver CS4

If you’ve never used Dreamweaver before, see Chapter 1 for a welcome and the

grand tour If you’re upgrading from Dreamweaver CS3 or some other version,

you’ll find that Dreamweaver CS4 offers a host of new features

• New Look When Adobe bought Dreamweaver from Macromedia, they pretty

much left the program’s user interface alone In CS4, Dreamweaver now shares

the same look and feel as other programs in the Creative Suite like Photoshop

and Illustrator Not only do the buttons, panels, windows, and toolbars look

different compared to previous versions of Dreamweaver, they can now be

con-figured in many different ways to match the way you want to work You’ll learn

more about this in Chapter 1

The Property inspector (see page 30) has also been revamped In addition to a

cosmetic makeover, it also works differently, making a clear distinction between

its two uses as an HTML building tool and a CSS creation tool

Trang 30

• Coding Improvements Adobe realized that a lot of Dreamweaver users

actu-ally spend a fair amount of time in Code view—tweaking HTML, coding CSS,and writing JavaScript programs Even if the visual Design view is where youfeel most comfortable, going into Code view can sometimes make your workmore accurate and go faster With that in mind, Dreamweaver CS4 offers manynew features meant to make working in Code view better First of all, manyWeb pages actually rely on other external files such as Cascading Style Sheetsand external JavaScript files A new, Related Files toolbar gives one click access

to every CSS, JavaScript or server-side programming file the current Web ment depends on

docu-In addition, you can now view Code and Design view in a side-by-side Splitview (previous versions could only display the two views on top of each other—not exactly an optimum use of the space on most widescreen displays.) In thisway, you can have the best of both worlds without having to repeatedly switchback and forth—this improvement alone is a great way for visual designers toget comfortable with and learn HTML, CSS, and JavaScript code, and for hand-coders to get used to Dreamweaver’s visual display

• More Spry goodies Dreamweaver CS3 introduced a powerful set of JavaScript

Web page enhancements based on Adobe’s “Spry Framework” (a collection ofJavaScript programs developed by Adobe) These new features made it easy toadd pop-up navigational menus, validate HTML forms, include complex, ani-mated visual effects, and add interactive data tables The Spry Menu Bar, forexample, lets you quickly and easily add a pop-up navigational menu to yoursite—without you having to learn all the messy JavaScript and CSS to make ithappen

While Dreamweaver CS4 doesn’t add as many cool new JavaScript goodies asthe last version, you’ll find new form validation tools for making sure a visitorregistering on a Web site provides a tricky-enough password, and that at leastone button is selected in a group of radio buttons (see Chapter 11) And thenew Spry Tooltip, presented in Chapter 12, lets you add pop-up informationbubbles that appear when a visitor mouses over an element on the page; forexample, you can provide supplemental information such as details about aphoto that a visitor moves his mouse over

In addition, the Spry Dataset tool has been improved, letting you use info from

a basic HTML table to create an engaging, interactive page that lets you presentlots of information in a compact page design—all updated with new informa-tion as a visitor clicks around the page Chapter 12 has the details

• JavaScript Programming benefits While Dreamweaver’s Spry tools make it

easy to add sophisticated programming to a page, many Web designers wantmore interactivity than Dreamweaver offers JavaScript plays a big role in manymodern Web sites, and lots of Web designers are choosing to dip their toes into

the JavaScript pool (if you are too, JavaScript: The Missing Manual is a great

place to start) Dreamweaver CS4 offers many new features aimed at making

Trang 31

JavaScript programming easier JavaScript code-hinting saves your weary

fin-gers by automatically completing JavaScript programming terms and anticipating

what you’ll type next

The new Live Mode actually lets you preview what your page will look like and

how its JavaScript will perform without having to leave the program—Apple’s

WebKit browser is now built-into Dreamweaver to give you a high-fidelity

rep-resentation of your Web page In addition, a “pause JavaScript” function lets

you stop a JavaScript program in mid-stream—for example, you can mouse

over a Spry navigation menu, see a pop-menu of options appear, and then

freeze the page with the menu open Besides just looking cool, this neat feature

lets you analyze the CSS of a dynamic element (like the pop-opened menu) and

see which styles are affecting it, so you can tweak the display to be just perfect

• Greater Photoshop integration Dreamweaver CS3 added integrated support

for Photoshop, so that a Web designer could copy from Photoshop and paste

into Dreamweaver It all happened thanks to an image optimization window in

Dreamweaver which streamlined the process of turning a Photoshop document

into a graphic format ready for the Web CS4 adds support for Adobe “Smart

Objects” so you can maintain a connection between a high-quality Photoshop

file and the smaller, lower quality Web version of the image If you edit the

original graphic file in Photoshop, Dreamweaver automatically updates the

Web version, skipping all those intermediate steps usually required to optimize

a Photoshop image for the Web

• And more Dreamweaver CS4 also includes lots of little enhancements, such as

improved FTP performance for more quickly transferring files to a Web server,

a more industry-standard method of embedding Flash movies into a Web page

(page 597), the ability to share your Dreamweaver screen with other users over

the Web, support for Adobe’s InContext Editing service to make it easier for

non-Web designers to update pages that you build for them, and more

Note: Adobe occasionally issues updates to Dreamweaver To make sure you’re using the latest version,

visit the Adobe Web site at www.adobe.com/products/dreamweaver/.

HTML, XHTML, CSS, and JavaScript 101

Underneath the hood of any Web page—whether it’s your uncle’s “Check out this

summer’s fishin’” page or the front door of a billion-dollar online retailer—is

nothing more than line after line of ordinary typed text With its use of simple

commands called tags, HTML (Hypertext Markup Language) is still at the heart of

most of the Web

Trang 32

Of Tags and Properties

In the example above—and, indeed, in the HTML code of any Web page you

examine—you’ll notice that most commands appear in pairs that surround a block

of text or other commands

These bracketed commands constitute the “markup” part of the Hypertext

Markup Language and are called tags Sandwiched between brackets, tags are

sim-ply instructions that tell a Web browser how to display the Web page

The starting tag of each pair tells the browser where the instruction begins, and theending tag tells it where the instruction ends An ending tag always includes a for-ward slash (/) after the first bracket symbol (<), which tells the browser that it is aclosing tag

Fortunately, Dreamweaver can generate all these tags automatically There’s no

need for you to memorize or even type these commands (although many grammers still enjoy doing so for greater control) Behind the scenes, Dream-weaver’s all-consuming mission is to convert your visual designs into underlyingcodes like these:

pro-• The <html> tag appears once at the beginning of a Web page and again (with

an added slash) at the end This tag tells a Web browser that the informationcontained in this document is written in HTML, as opposed to some other lan-guage All the contents of a page, including other tags, appear between theopening and closing <html> tags

If you were to think of a Web page as a tree, the <html> tag would be its trunk.Springing from the trunk are two branches that represent the two main parts ofany Web page: the head and the body

• The head of a Web page, surrounded by <head> tags, contains the title of the

page It may also provide other, invisible information (such as search words) that browsers and Web search engines can exploit

key-In addition, the head can contain information that the Web browser uses fordisplaying the Web page and adding interactivity CSS styles and JavaScript

Trang 33

code, for example, can be stored in the head (as can links to external files

con-taining either of these elements) In fact, Dreamweaver’s Spry widgets

(Chapter 12) achieve their interactive effects with the help of JavaScript code

that’s stored in separate files and linked to from a page’s head

• The body of a Web page, as set apart by its surrounding <body> tags, contains

all the information that appears inside a browser window—headlines, text,

pic-tures, and so on

In Dreamweaver, the blank white portion of the document window represents

the body area (see Figure I-1) It resembles the blank window of a word

pro-cessing program

Most of your work with Dreamweaver involves inserting and formatting text,

pic-tures, and other objects in the body of the document Many tags commonly used

in Web pages appear within the <body> tag Here are a few:

• You can tell a Web browser where a paragraph of text begins with a <p>

(open-ing paragraph tag), and where it ends with a </p> (clos(open-ing paragraph tag)

• The <strong> tag is used to emphasize text If you surround some text with it

and its partner tag, </strong>, you get boldface type The HTML snippet

<strong>Warning!</strong> would tell a Web browser to display the word

“Warning!” in bold type on the screen

• The <a> tag, or anchor tag, creates a link (hyperlink) in a Web page A link, of

course, can lead anywhere on the Web How do you tell the browser where the

link should point? Simply give address instructions to the browser inside the

<a> tags For instance, you might type <a href="http://www.missingmanuals.

com/">Click here!</a>.

Figure I-1:

The document window displays your page as you build it You can add text, graphics, and other elements to it, and—thanks to Dreamweaver’s visual approach—see a close approximation of how the page will appear in

a Web browser.

Trang 34

The browser knows that when your visitor clicks the words “Click here!” it

should go to the Missing Manuals Web site The href part of the tag is called, in Dreamweaver, a property (you may also hear the term attribute), and the URL (the Uniform Resource Locator, or Web address) is the value In this example,

http://www.missingmanuals.com is the value of the href property.

Fortunately, Dreamweaver exempts you from having to type any of these codes

and provides an easy-to-use window called the Property inspector for adding

prop-erties to your tags and other page elements To create links the Dreamweaver way(read: the easy way), turn to Chapter 5

Note: For a full-fledged introduction to HTML, check out Creating a Web Site: The Missing Manual For

a primer that’s geared to readers who want to master CSS, pick up a copy of CSS: The Missing Manual.

And if you want to add interactivity to your Web pages (beyond the cool, ready-to-use features offered by

Dreamweaver) then you might be interested in JavaScript: The Missing Manual.

XHTML, Too

Like any technology, HTML has evolved over time Although standard HTML hasserved its purpose well, it’s always been a somewhat sloppy language Among otherthings, it allows uppercase, lowercase, or mixed-case letters in tags (<body> and

<BODY> are both correct, for example) and permits unclosed tags (so that youcan use a single <p> tag without the closing </p> to create a paragraph) Whilethis flexibility may make page writing easier, it also makes life more difficult forWeb browsers, smart phones, and other technologies that must interact with data

on the Web Additionally, HTML doesn’t work with one of the hottest Internetlanguages: XML, or Extensible Markup Language (see page 522 for a quick intro toXML) In fact, XHTML is just an “XML-ified” version of HTML

To keep pace with the times, an improved version of HTML called XHTML was duced back in 2000 and you’ll find it used frequently on many sites Dreamweaver CS4can create and work with XHTML files as well as plain HTML If you understand onlyHTML, don’t worry—XHTML isn’t a revolutionary new language that takes years tolearn It’s basically HTML, but with somewhat stricter guidelines For example, the

intro-HTML page code shown on page 8 would look like this in Xintro-HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Hey, I am the title of this Web page.</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso 8859-1" />

Trang 35

Notice that everything below the <head> is nearly the same as the HTML page.

The information that begins the page, however, is how the page identifies which

standards it conforms to In this case, it merely says that the page is using a

partic-ular brand of HTML, called XHTML, and more specifically a type of XHTML

called Transitional 1.0 (Don’t worry—Dreamweaver automatically writes all of

this code when you create a new XHTML page.)

As you can see, the real code used to make the page is much like HTML To make an

XHTML file comply with XML, however, there are a few strict rules to keep in mind:

• Begin the page with a document-type declaration and a namespace That’s the

first few lines in the code above They simply state what type of document the

page is and point to files on the Web that contain definitions for this type of

file This document-type declaration (or DTD) is also important as it affects

how Web browsers display a Web page—stick with any of the DTDs

Dream-weaver writes and you’ll be OK

• Tags and tag attributes must be lowercase Unlike in HTML, typing the tag

<BODY> in an XHTML file is incorrect It must be lowercase like this: <body>

• Quotation marks are required for tag attributes For example, a link written

like this: <a href=http://www.missingmanuals.com > is valid in HTML, but

doesn’t work in XHTML You have to enclose the value of the href property in

quotes: <a href="http://www.missingmanuals.com">.

• All tags (even empty tags) must be closed To create a paragraph in XHTML,

for example, you must begin with <p> and end with </p> However, some tags

don’t come in pairs These tags, called empty tags, have no closing tag The line

break tag is one example To close an empty tag, you must include a backslash

at the end of the tag, like this: <br />

If all this seems a bit confusing, don’t worry All these strict XHTML rules are built

into Dreamweaver, so creating an XHTML page using Dreamweaver’s visual

design tools won’t feel one bit different from creating an old-style HTML page

(For more information on creating an XHTML page in Dreamweaver, see page 44.)

In fact, with just a couple of exceptions discussed on page 46, it doesn’t really

mat-ter which version of HTML or XHTML you use—pick one and let Dreamweaver

take care of the rest

Note: When XHTML was introduced it was heralded as the next big thing, and an intermediate step in

the transition to XML as the prime language of the Web History proves that that prediction was a bit

gran-diose As it turns out, the complexity of moving to XML has kept browser manufacturers from following

the XML path laid down by the W3C—the group responsible for coming up with many Internet

technolo-gies Now, the W3C is working on a new version of HTML, called HTML 5, which is a move away from

XML and back to plain HTML—albeit an enhanced version of HTML Since all the browser manufacturers

are behind HTML 5 (and some browsers are already adopting parts of it), it’s a good bet that down the

line HTML 5 will be the new big thing So if your know-it-all co-worker says that you MUST use XHTML

because it’s the future, just say “What about HTML 5?” That should keep him quiet To learn more about

HTML 5 visit www.w3.org/html/wg/html5/.

Trang 36

Adding Style with Cascading Style Sheets

HTML used to be the only language you needed to know You could build pageswith colorful text and graphics and make words jump out using different sizes,fonts, and colors But today, you can’t add much visual sophistication to a sitewithout CSS CSS is a formatting language used to make text look good, addsophisticated layout to pages, and basically add style to your site

From now on, think of HTML as merely the language you use to give organization

to a page It helps identify and structure the stuff you want the world to knowabout Tags like <h1>, <h2>, and <title> denote headlines and assign them rela-

tive importance: a heading 1 is more important than a heading 2 (and can also

affect how a search engine like Google adds a page to its search listings [see page96]) The <p> tag indicates a basic paragraph of information Other tags providefurther structural clues: for example, a <ul> tag identifies a bulleted list (to make alist of recipe ingredients more intelligible)

Cascading Style Sheets, on the other hand, add design flair to the highly structuredHTML content, making it more beautiful and easier to read Essentially, a CSSstyle is just a rule that tells a Web browser how to display a particular element on apage—for example, to make a <h1> tag appear 36 pixels tall, in the Verdana fontand the color orange

But CSS is more powerful than that You can use it to add borders, change margins,and even control the exact placement of an element on a page

If you want to be a Web designer, you need to get to know Cascading Style Sheets.You’ll learn more about this exciting technology throughout this book In fact, it’s

so important for current Web design, that this edition of Dreamweaver: The Missing

Manual includes expanded coverage and examples of CSS in most chapters.

Adding Interactivity with JavaScript

A normal Web page—just regular HTML and CSS—isn’t very responsive: Webvisitors basically interact with a Web page by clicking a link to load a new Webpage While we’ve grown accustomed to the “click-and-wait” slowness of the Web,we’re also used to the way our computers’ desktop programs react immediately toour every mouse-click JavaScript is a programming language that lets you supercharge your HTML with animation, interactivity, and dynamic visual effects Java-Script also can make a Web page more useful, by supplying immediate feedback toWeb site visitors For example, a JavaScript-powered shopping cart page caninstantly display a total cost, with tax and shipping, the moment a visitor selects aproduct to buy; or JavaScript can produce an error message immediately aftersomeone attempts to submit a Web form that’s missing necessary information.JavaScript’s main selling point is its immediacy It lets Web pages respond instantly

to the actions of someone interacting with a page: clicking a link, filling out a form,

or merely moving the mouse around the screen JavaScript doesn’t suffer from the

Trang 37

frustrating delay associated with “server-side” programming languages like PHP

which rely on communication between the Web browser and the Web server—in

other words, constantly loading and reloading Web pages JavaScript lets you create

Web pages that feel and act more like desktop programs than Web pages

If you’ve visited Google Maps (http://maps.google.com/) you’ve seen JavaScript in

action Google Maps lets you view a map, zoom in to get a detailed view of streets,

and zoom out to get a birds-eye view of how to get across town, the state, or the

nation While there have been lots of map Web sites before Google, those sites

always required reloading multiple Web pages (a usually slow process) to get to the

information you wanted Google Maps, on the other hand, works without page

refreshes: It responds immediately to your choices

The programs you create with JavaScript can range from the really simple (such as

popping-up a new browser window with a Web page in it) to full blown “Web

applications” such as Google Docs (http://docs.google.com/), which let you create

presentations, edit documents, and create spreadsheets using your Web browser—

all with the feel of a program running directly on your computer

While JavaScript programming can be difficult, Dreamweaver has plenty of tools

to let you add sophisticated interactivity to your Web sites—from animations to

drop-down navigation menus—in just a few mouse clicks

The Very Basics

You’ll find very little jargon or nerd terminology in this book You will, however,

encounter a few terms and concepts that you’ll encounter frequently in your

com-puting life:

• Clicking This book gives you three kinds of instructions that require you to use

your computer’s mouse or trackpad To click means to point the arrow cursor at

something on the screen and then—without moving the cursor at all—press

and release the clicker button on the mouse (or laptop trackpad) To

double-click, of course, means to click twice in rapid succession, again without moving

the cursor at all And to drag means to move the cursor while holding down the

button

• Keyboard shortcuts Every time you take your hand off the keyboard to move the

mouse, you lose time and potentially disrupt your creative flow That’s why many

experienced computer fans use keystroke combinations instead of menu

com-mands wherever possible Ctrl+B (c-B for Mac folks), for example, is a keyboard

shortcut for boldface type in Dreamweaver (and most other programs)

When you see a shortcut like Ctrl+S (c-S), it’s telling you to hold down the

Ctrl orckey and, while it’s down, type the letter S, and then release both keys

(This command, by the way, saves changes to the current document.)

Trang 38

• Choice is good Dreamweaver frequently gives you several ways to trigger a

par-ticular command—by selecting a menu command, or by clicking a toolbar ton, or by pressing a key combination, for example Some people prefer the

but-speed of keyboard shortcuts; others like the satisfaction of a visual commandavailable in menus or toolbars This book lists all the alternatives; use which-ever you find most convenient

About This Book

Despite the many improvements in software over the years, one feature has grownconsistently worse: documentation Until version 4, Dreamweaver came with a

printed manual But since MX 2004, all you get is a Getting Started booklet To get

any real information, you need to delve into the program’s online help screens.But even if you have no problem reading a help screen in one window as you work

in another, something’s still missing At times, the terse electronic help screensassume you already understand the discussion at hand, and hurriedly skip overimportant topics that require an in-depth presentation In addition, you don’talways get an objective evaluation of the program’s features Engineers often add

technically sophisticated features to a program because they can, not because you

need them You shouldn’t have to waste your time learning tools that don’t helpyou get your work done

The purpose of this book, then, is to serve as the manual that should have been inthe box In this book’s pages, you’ll find step-by-step instructions for using everyDreamweaver feature, including those you may not even have quite understood,let alone mastered, such as Libraries, Layout view, Behaviors, and Dreamweaver’sSpry tools In addition, you’ll find honest evaluations of each tool to help youdetermine which ones are useful to you, as well as how and when to use them

Note: This book periodically recommends other books, covering topics that are too specialized or

tan-gential for a manual about using Dreamweaver Careful readers may notice that not every one of these titles is published by Missing Manual parent O’Reilly Media While we’re happy to mention other Missing Manuals and books in the O’Reilly family, if there’s a great book out there that doesn’t happen to be pub- lished by O’Reilly, we’ll still let you know about it.

Dreamweaver CS4: The Missing Manual is designed to accommodate readers at

every technical level The primary discussions are written for advanced-beginner orintermediate computer users But if you’re new to building Web pages, specialsidebar articles called “Up To Speed” provide the introductory information youneed to understand the topic at hand If you’re a Web veteran, on the other hand,keep your eye out for similar shaded boxes called “Power Users’ Clinic” They offermore technical tips, tricks, and shortcuts for the experienced computer fan

Trang 39

Throughout this book, and throughout the Missing Manual series, you’ll find

sen-tences like this one: “Open the System ➝Library➝Fonts folder.” That’s

short-hand for a much longer instruction that directs you to open three nested folders in

sequence, like this: “On your hard drive, you’ll find a folder called System Open

that Inside the System folder window is a folder called Library; double-click it to

open it Inside that folder is yet another one called Fonts Double-click to open it,

too.”

Similarly, this kind of arrow shorthand helps to simplify the business of choosing

commands in menus, as shown in Figure I-2

Macintosh and Windows

Dreamweaver CS4 works almost precisely the same way in its Macintosh and

Win-dows versions Every button in every dialog box is exactly the same; the software

response to every command is identical In this book, the illustrations have been

given even-handed treatment, alternating between the various operating systems

where Dreamweaver feels at home (Windows XP, Windows Vista, and Mac OS X)

One of the biggest differences between Mac and Windows software is the

key-strokes, because the Ctrl key in Windows is the equivalent of the Macintoshc key

it Then click Layout Objects in that menu and choose Div Tag in the resulting submenu.”

Trang 40

About the Outline

Dreamweaver CS4: The Missing Manual is divided into six parts, each containing

several chapters:

• Part One: Building a Web Page, explores Dreamweaver’s interface and takes

you through the basic steps of building a Web page It explains how to add textand format it, how to link from one page to another, how to spice up yourdesigns with graphics, and introduces you to Cascading Style Sheets

• Part Two: Building a Better Web Page, takes you deeper into Dreamweaver and

provides in-depth CSS coverage In addition, you’ll get step-by-step tions for creating advanced page layouts, as well as advice on how to view andwork with the underlying HTML code of a page

instruc-Note: Previous versions of this book contained a chapter on HTML frames—a method of displaying

sev-eral Web pages in a single Web browser window This technique is going the way of the dodo bird Since Dreamweaver CS4 is full of so many useful and exciting features and this book’s already bursting at its seams (if we added any more pages, we’d have to issue a medical warning to those with bad backs), the

frames chapter has been moved online You can find it, free of charge, at www.sawmac.com/missing/

dw8/appc.pdf.

• Part Three: Bringing Your Pages to Life, helps you add interactivity to your site.

From using forms to collect information from your site’s visitors to addinginteractive page widgets like tabbed interfaces with the Spry framework, thissection guides you through adding animation, multimedia, and other interac-tive effects with ease

• Part Four: Building a Web Site, covers the big picture: managing the pages and

files in your Web site, testing links and pages, and moving your site onto a Webserver connected to the Internet And since you’re not always working solo, thissection also covers features that let you work with a team of Web developers

• Part Five, Dreamweaver Power, shows you how to take full advantage of such

time-saving features as Libraries, Templates, and History panel automation Italso covers Dreamweaver’s Extension Manager, a program that can add hun-dreds of new free and commercial features to the program

Ngày đăng: 30/05/2016, 00:10

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN