Sams Teach Yourself HTML, CSS And JavaScript All In One 9788131786970, 9789332573116, 8131786978

Description The all-in-one HTML, CSS and JavaScript beginner's guide:covering the three most important languages fo

1,497 71 13MB

English Pages 608 [625] Year 2012

Report DMCA / Copyright

DOWNLOAD FILE

Sams Teach Yourself HTML, CSS And JavaScript All In One
 9788131786970, 9789332573116, 8131786978

Table of contents :
Cover......Page 1
Title......Page 2
Copyright......Page 3
Contents at a Glance......Page 4
Table of Contents......Page 5
About the Author......Page 8
A Brief History of HTML and the World Wide Web......Page 10
Creating Web Content......Page 11
Understanding Web Content Delivery......Page 12
Selecting a Web Hosting Provider......Page 15
Testing with Multiple Web Browsers......Page 17
Creating a Sample File......Page 18
Using FTP to Transfer Files......Page 19
Distributing Content Without a Web Server......Page 27
Tips for Testing Web Content......Page 28
Getting Prepared......Page 34
Getting Started with a Simple Web Page......Page 35
HTML Tags Every XHTML Web Page Must Have......Page 38
Organizing a Page with Paragraphs and Line Breaks......Page 40
Organizing Your Content with Headings......Page 43
Validating Your Web Content......Page 45
The Scoop on HTML, XML, XHTML, and HTML5......Page 47
CHAPTER 3: Understanding Cascading Style Sheets ......Page 54
How CSS Works......Page 55
A Basic Style Sheet......Page 56
A CSS Style Primer......Page 61
Using Style Classes......Page 66
Internal Style Sheets and Inline Styles......Page 68
Learning Web Scripting Basics......Page 74
How JavaScript Fits into a Web Page......Page 76
Exploring JavaScript’s Capabilities......Page 79
Beginning the Script......Page 80
Adding JavaScript Statements......Page 81
Adding the Script to a Web Page......Page 82
Testing the Script......Page 83
CHAPTER 5: Working with Fonts, Text Blocks, and Lists ......Page 90
Boldface, Italics, and Special Text Formatting......Page 91
Tweaking the Font......Page 94
Working with Special Characters......Page 98
Aligning Text on a Page......Page 101
The Three Types of HTML Lists......Page 104
Placing Lists Within Lists......Page 106
Creating a Simple Table......Page 116
Controlling Table Sizes......Page 119
Alignment and Spanning Within Tables......Page 122
Page Layout with Tables......Page 125
Using Web Addresses......Page 132
Linking Within a Page Using Anchors......Page 135
Linking Between Your Own Web Content......Page 138
Linking to External Web Content......Page 140
Linking to an Email Address......Page 141
Using CSS to Style Hyperlinks......Page 143
Best Practices for Choosing Colors......Page 150
Understanding Web Colors......Page 152
Using Hexadecimal Values for Colors......Page 154
Using CSS to Set Background, Text, and Border Colors......Page 155
Choosing Graphics Software......Page 157
The Least You Need to Know About Graphics......Page 158
Preparing Photographic Images......Page 159
Creating Banners and Buttons......Page 164
Reducing the Number of Colors in an Image......Page 166
Working with Transparent Images......Page 167
Creating Tiled Backgrounds......Page 168
Creating Animated Web Graphics......Page 169
Placing Images on a Web Page......Page 170
Describing Images with Text......Page 172
Aligning Images......Page 174
Turning Images into Links......Page 178
Using Background Images......Page 180
Using Imagemaps......Page 182
Integrating Multimedia into Your Website......Page 187
CHAPTER 9: Working with Margins, Padding, Alignment, and Floating ......Page 200
Using Margins......Page 201
Padding Elements......Page 208
Keeping Everything Aligned......Page 212
Understanding the Float Property......Page 213
The CSS Box Model......Page 218
The Whole Scoop on Positioning......Page 222
Controlling the Way Things Stack Up......Page 226
Managing the Flow of Text......Page 229
CHAPTER 11: Using CSS to Do More with Lists, Text, and Navigation ......Page 234
How the CSS Box Model Affects Lists......Page 235
Placing List Item Indicators......Page 238
Creating Image Maps with List Items and CSS......Page 240
How Navigation Lists Differ from Regular Lists......Page 244
Creating Vertical Navigation with CSS......Page 245
Creating Horizontal Navigation with CSS......Page 254
CHAPTER 12: Creating Fixed or Liquid Layouts ......Page 262
Understanding Fixed Layouts......Page 263
Understanding Liquid Layouts......Page 264
Creating a Fixed/Liquid Hybrid Layout......Page 267
Understanding the Different Types of Scripting273......Page 282
Including JavaScript in HTML......Page 283
Displaying Random Content......Page 285
Understanding the Document Object Model......Page 289
Changing Images Based on User Interaction......Page 290
Basic Concepts......Page 296
JavaScript Syntax Rules......Page 300
Best Practices for JavaScript......Page 302
Understanding the Document Object Model (DOM)......Page 308
Working with the document Object......Page 309
Accessing Browser History......Page 312
Working with the location Object......Page 314
More About the DOM Structure......Page 315
Working with DOM Nodes......Page 318
Creating Positionable Elements (Layers)......Page 320
Hiding and Showing Objects......Page 325
Modifying Text Within a Page......Page 326
Adding Text to a Page......Page 328
CHAPTER 16: Using JavaScript Variables, Strings, and Arrays ......Page 335
Using Variables......Page 334
Understanding Expressions and Operators......Page 337
Data Types in JavaScript......Page 339
Converting Between Data Types......Page 340
Using String Objects......Page 341
Working with Substrings......Page 344
Using Numeric Arrays......Page 346
Using String Arrays......Page 347
Sorting a Numeric Array......Page 349
Using Functions......Page 356
Introducing Objects......Page 361
Using Objects to Simplify Scripting......Page 363
Extending Built-in Objects......Page 365
Using the Math Object......Page 369
Working with Math Functions......Page 370
Using the with Keyword......Page 372
Working with Dates......Page 373
The if Statement......Page 378
Using Shorthand Conditional Expressions......Page 381
Testing Multiple Conditions with if and else......Page 382
Using Multiple Conditions with switch......Page 384
Using for Loops......Page 386
Using while Loops......Page 388
Working with Loops......Page 389
Looping Through Object Properties......Page 391
Understanding Event Handlers......Page 398
Using Mouse Events......Page 403
Using Keyboard Events......Page 406
Using the onLoad and onUnload Events......Page 408
Using onclick to Change Appearance......Page 409
Controlling Windows with Objects......Page 418
Moving and Resizing Windows......Page 422
Using Timeouts......Page 423
Displaying Dialog Boxes......Page 426
Working with Frames......Page 427
Building a Frameset......Page 429
Linking Between Frames and Windows......Page 432
Using Inline Frames......Page 435
Scripting Best Practices......Page 442
Reading Browser Information......Page 449
Cross-Browser Scripting......Page 452
Supporting Non-JavaScript Browsers......Page 454
Using Third-Party Libraries......Page 462
Other Libraries......Page 465
Introducing Greasemonkey......Page 472
Working with User Scripts......Page 475
Creating Your Own User Scripts......Page 477
Introducing AJAX......Page 488
Using XMLHttpRequest......Page 492
Creating a Simple AJAX Library......Page 494
Creating an AJAX Quiz Using the Library......Page 496
Debugging AJAX Applications......Page 500
CHAPTER 25: Creating Print-Friendly Web Pages ......Page 508
What Makes a Page Print-Friendly?......Page 509
Applying a Media-Specific Style Sheet......Page 512
Designing a Style Sheet for Print Pages......Page 514
Viewing a Web Page in Print Preview......Page 517
How HTML Forms Work......Page 522
Creating a Form......Page 523
Naming Each Piece of Form Data......Page 528
Exploring Form Input Controls......Page 530
Submitting Form Data......Page 536
Displaying Data from a Form......Page 537
Sending Form Results by Email......Page 539
CHAPTER 27: Organizing and Managing a Website ......Page 546
When One Page Is Enough......Page 547
Organizing a Simple Site......Page 549
Organizing a Larger Site......Page 552
Writing Maintainable Code......Page 555
Thinking About Version Control......Page 557
Publicizing Your Website......Page 562
Listing Your Pages with the Major Search Sites......Page 564
Providing Hints for Search Engines......Page 565
Additional Tips for Search Engine Optimization......Page 571
INDEX ......Page 576

Polecaj historie