This book features content from Sams Teach Yourself HTML & CSS in 24 Hours plus content from Michael Moncour’s Sams Teach Yourself JavaScript in 24 Hours (4th ed.). I am grateful to Phil Ballard for pitching in on some text and giving it the general once-over as technical editor. Smushing together different text by different authors and then refreshing it (internet time, after all) is something I enjoy, but boy howdy are extra sets of eyes important to the process.
The goal of this book is to give you all the skills you need to create a modern, standards-compliant web site using XHTML and CSS (discussing HTML 5 where applicable, although it is not a how-to for HTML 5—look for that in 2012!) with some level of interactivity and dynamism using JavaScript and JavaScript libraries. Check out the Table of Contents below to see if this could be a book for you!
- ISBN 0672333325, © Sams 2011
- Download the source code.
- Translations: Chinese (Simplified), Greek, Spanish

Table of Contents
This table of contents reflects the sub-headings within each chapter. Each chapter also has a summary, quiz questions, and one or more activities for you to try on your own.
» PART I: GETTING STARTED ON THE WEB
Chapter 1: Understanding How the Web Works
- A Brief History of HTML and the World Wide Web
- Creating Web Content
- Understanding Web Content Delivery
- Selecting a Web Hosting Provider
- Testing with Multiple Web Browsers
- Creating a Sample File
- Using FTP to Transfer Files
- Distributing Content without a Web Server
- Tips for Testing Web Content
Chapter 2: Understanding HTML and XHTML Connections
- Getting Prepared
- Getting Started with a Simple Web Page
- HTML Tags Every XHTML Web Page Must Have
- Organizing a Page with Paragraphs and Line Breaks
- Organizing Your Content with Headings
- Validating Your Web Content
- The Scoop on HTML, XML, XHTML, and HTML 5
Chapter 3: Understanding Cascading Style Sheets
- How CSS Works
- A Basic Style Sheet
- A CSS Style Primer
- Using Style Classes
- Using Style IDs
- Internal Style Sheets and Inline Styles
Chapter 4: Understanding JavaScript
- Learning Web Scripting Basics
- How JavaScript Fits into a Web Page
- Exploring JavaScript’s Capabilities
- Displaying Time with JavaScript
- Beginning the Script
- Adding JavaScript Statements
- Creating Output
- Adding the Script to the Web Page
- Testing the Script
» PART II: BUILDING BLOCKS OF PRACTICAL WEB DESIGN
Chapter 5: Working with Fonts, Text Blocks and Lists
- Boldface, Italics, and Special Text Formatting
- Tweaking the Font
- Working with Special Characters
- Aligning Text on a Page
- The Three Types of HTML Lists
- Placing Lists Within Lists
Chapter 6: Using Tables to Display Information
- Creating a Simple Table
- Controlling Table Sizes
- Alignment and Spanning Within Tables
- Page Layout with Tables
Chapter 7: Using External and Internal Links
- Using Web Addresses
- Linking Within a Page Using Anchors
- Linking Between Your Own Web Content
- Linking to External Web Content
- Linking to an Email Address
- Opening a Link in a New Browser Window
- Using CSS to Style Hyperlinks
Chapter 8: Working with Colors, Images, and Multimedia
- Best Practices for Choosing Colors
- Understanding Web Colors
- Using Hexadecimal Values for Colors
- Using CSS to Set Background, Text, and Border Colors
- Choosing Graphics Software
- The Least You Need to Know About Graphics
- Preparing Photographic Images
- Creating Banners and Buttons
- Reducing the Number of Colors in an Image
- Working with Transparent Images
- Creating Tiled Backgrounds
- Creating Animated Web Graphics
- Placing Images on a Web Page
- Describing Images with Text
- Specifying Image Height and Width
- Aligning Images
- Turning Images into Links
- Using Background Images
- Using Imagemaps
» PART III: ADVANCED WEB PAGE DESIGN WITH CSS
Chapter 9: Working with Margins, Padding, Alignment, and Floating
- Using Margins
- Padding Elements
- Keeping Everything Aligned
- Understanding the Float Property
Chapter 10: Understanding the CSS Box Model and Positioning
- The CSS Box Model
- The Whole Scoop on Positioning
- Controlling the Way Things Stack Up
- Managing the Flow of Text
Chapter 11: Using CSS to Do More with Lists, Text, and Navigation
- HTML List Refresher
- How the CSS Box Model Affects Lists
- Placing List Item Indicators
- Creating Image Maps with List Items and CSS
- How Navigation Lists Differ from Regular Lists
- Creating Vertical Navigation with CSS
- Creating Horizontal Navigation with CSS
Chapter 12: Creating Fixed or Liquid Layouts
- Understanding Fixed Layouts
- Understanding Liquid Layouts
- Creating a Fixed/Liquid Hybrid Layout
» PART IV: GETTING STARTED WITH DYNAMIC WEB SITES
Chapter 13: Understanding Dynamic Web Sites
- Understanding the Different Types of Scripting
- Including JavaScript in HTML
- Displaying Random Content
- Understanding the Document Object Model
- Changing Images Based on User Interaction
Chapter 14: Getting Started with JavaScript Programming
- Basic Concepts
- JavaScript Syntax Rules
- Using Comments
- Best Practices for JavaScript
Chapter 15: Working with the Document Object Model (DOM)
- Understanding the Document Object Model (DOM)
- Using window Objects
- Working with the document Object
- Accessing Browser History
- Working with the location Object
- More About the DOM Structure
- Working with DOM Nodes
- Creating Positionable Elements (Layers)
- Hiding and Showing Objects
- Modifying Text Within a Page
- Adding Text to a Page
Chapter 16: Using JavaScript Variables, Strings, and Arrays
- Using Variables
- Understanding Expressions and Operators
- Data Types in JavaScript
- Converting Between Data Types
- Using String Objects
- Working with Substrings
- Using Numeric Arrays
- Using String Arrays
- Sorting a Numeric Array
Chapter 17: Using JavaScript Functions and Objects
- Using Functions
- Introducing Objects
- Using Objects to Simplify Scripting
- Extending Built-in Objects
- Using the Math Object
- Working with Math Functions
- Using the with Keyword
- Working with Dates
Chapter 18: Controlling Flow with Conditions and Loops
- The if Statement
- Using Shorthand Conditional Expressions
- Testing Multiple Conditions with switch
- Using for Loops
- Using while Loops
- Using do…while Loops
- Working with Loops
- Looping Through Object Properties
Chapter 19: Responding to Events
- Understanding Event Handlers
- Using Mouse Events
- Using Keyboard Events
- Using the onLoad and onUnload Events
- Using onClick to Change <div> Appearance
Chapter 20: Using Windows and Frames
- Controlling Windows with Objects
- Moving and Resizing Windows
- Using Timeouts
- Displaying Dialog Boxes
- Working with Frames
- Building a Frameset
- Linking Between Frames and Windows
- Using Inline Frames
» PART V: ADVANCED JAVASCRIPT PROGRAMMING
Chapter 21: Using Unobtrusive JavaScript
- Scripting Best Practices
- Reading Browser Information
- Cross-Browser Scripting
- Supporting Non-JavaScript Browsers
Chapter 22: Using Third-Party Libraries
- Using Third-Party Libraries (Prototype, jQuery, Script.aculo.us, AJAX Frameworks)
- Other Libraries
Chapter 23: Greasemonkey: Enhancing the Web with JavaScript
- Introducing Greasemonkey
- Working with User Scripts
- Creating Your Own User Scripts
Chapter 24: AJAX: Remote Scripting
- Introducing AJAX
- Using XMLHttpRequest
- Creating a Simple AJAX Library
- Creating an AJAX Quiz Using the Library
- Debugging AJAX Applications
» PART VI: ADVANCED WEBSITE FUNCTIONALITY AND MANAGEMENT
Chapter 25: Creating Print-Friendly Web Pages
- What Makes a Page Print-Friendly?
- Applying a Media-Specific Style Sheet
- Designing a Style Sheet for Print Pages
- Viewing a Web Page in Print Preview
Chapter 26: Working with Web-Based Forms
- How HTML Forms Work
- Creating a Form
- Accepting Text Input
- Naming Each Piece of Form Data
- Exploring Form Input Controls
- Submitting Form Data
- Accessing Form Elements with JavaScript
- Displaying Data from a Form
- Sending Form Results by Email
Chapter 27: Organizing and Managing a Web Site
- When One Page Is Enough
- Organizing a Simple Site
- Organizing a Larger Site
- Writing Maintainable HTML Code
- Thinking About Version Control
Chapter 28: Helping People Find Your Web Pages
- Publicizing Your Web Site
- Listing Your Pages with the Major Search Sites
- Providing Hints for Search Engines
- Additional Tips for Search Engine Optimization
