HTML, XHTML, & CSS All-in-One For Dummies®, 2nd Edition

Book description

A complete and fully updated reference for these key Web technologies

HTML, XHTML, and CSS are essential tools for creating dynamic Web sites. This friendly, all-in-one guide covers what programmers need to know about each of the technologies and how to use them together.

Like the bestselling first edition, HTML, XHTML, and CSS All-in-One For Dummies, 2nd Edition makes it easy to grasp the fundamentals and start building effective Web pages. With new information about Web 2.0 and Ajax, it's the perfect reference as well.

  • HTML, XHTML, and CSS are the key technologies for building dynamic Web pages

  • This friendly, all-in-one guide explains each technology, shows how to use them together, and examines quality Web design and layout

  • Six self-contained minibooks cover HTML, CSS, design and layout, client-side JavaScript, Ajax and server-side, and putting it all together

  • Covers new Web development advancements including new technologies and changes to the standards

  • Includes a CD with additional valuable Web development programs and a companion Web site featuring the code used in the book

Web programmers and designers will find what they most need to know in HTML, XHTML, and CSS All-in-One For Dummies, 2nd Edition, helping them create the type of Web sites that today's market demands.

Table of contents

  1. Copyright
  2. About the Author
  3. Author's Acknowledgments
  4. Publisher's Acknowledgments
  5. Introduction
    1. No Experience Necessary
    2. Great for Advanced Folks, Too!
    3. Use Any Computer
    4. Don't Buy Any Software
    5. How This Book Is Organized
    6. New for the Second Edition
    7. Icons Used in This Book
    8. What's Next?
  6. I. Creating the HTML/XHTML Foundation
    1. 1. Sound HTML Foundations
      1. 1.1. Creating a Basic Page
      2. 1.2. Understanding the HTML in the Basic Page
      3. 1.3. Meeting Your New Friends, the Tags
      4. 1.4. Setting Up Your System
        1. 1.4.1. Displaying file extensions
        2. 1.4.2. Setting up your software
    2. 2. It's All about Validation
      1. 2.1. Somebody Stop the HTML Madness!
        1. 2.1.1. XHTML to the rescue
        2. 2.1.2. There's XHTML and there's good XHTML
      2. 2.2. Building an XHTML Document
        1. 2.2.1. Don't memorize all this!
        2. 2.2.2. The DOCTYPE tag
        3. 2.2.3. The xmlns attribute
        4. 2.2.4. The meta tag
        5. 2.2.5. You validate me
      3. 2.3. Validating Your Page
        1. 2.3.1. Aesop visits W3C
          1. 2.3.1.1. Examining the overview
          2. 2.3.1.2. Validating the page
          3. 2.3.1.3. Examining the first error
          4. 2.3.1.4. Fixing the title
          5. 2.3.1.5. Solving the next error
          6. 2.3.1.6. Checking the headline repair
        2. 2.3.2. Showing off your mad skillz
        3. 2.3.3. Using Tidy to repair pages
    3. 3. Choosing Your Tools
      1. 3.1. What's Wrong with the Big Boys?
      2. 3.2. Alternative Web Development Tools
        1. 3.2.1. The features you need on your computer
        2. 3.2.2. Building a basic toolbox
      3. 3.3. Picking a Text Editor
        1. 3.3.1. Tools to avoid unless you have nothing else
          1. 3.3.1.1. Microsoft Word
          2. 3.3.1.2. Windows Notepad
          3. 3.3.1.3. Mac TextEdit
        2. 3.3.2. A noteworthy editor: Notepad++
        3. 3.3.3. The old standards: VI and Emacs
          1. 3.3.3.1. VI and VIM
          2. 3.3.3.2. Emacs
        4. 3.3.4. Other text editors
      4. 3.4. The Web Developer's Browser
        1. 3.4.1. A little ancient history
          1. 3.4.1.1. Mosaic/Netscape — the killer application
          2. 3.4.1.2. Microsoft enters (and wins) the battle
          3. 3.4.1.3. Firefox shakes up the world
        2. 3.4.2. Overview of the prominent browsers
          1. 3.4.2.1. Microsoft Internet Explorer 7 and 8
          2. 3.4.2.2. Older versions of Internet Explorer
          3. 3.4.2.3. Mozilla Firefox
          4. 3.4.2.4. Google Chrome
        3. 3.4.3. Other notable browsers
          1. 3.4.3.1. Opera
          2. 3.4.3.2. Webkit/Safari
          3. 3.4.3.3. Mozilla
          4. 3.4.3.4. Portable browsers
          5. 3.4.3.5. Text-only browsers
        4. 3.4.4. The bottom line in browsers
      5. 3.5. Tricking Out Firefox
        1. 3.5.1. Validating your pages with HTML Validator
        2. 3.5.2. Using the Web Developer toolbar
        3. 3.5.3. Using Firebug
      6. 3.6. Using a Full-Blown IDE
        1. 3.6.1. Introducing Aptana
        2. 3.6.2. Customizing Aptana
          1. 3.6.2.1. Getting to the HTML editor preferences
          2. 3.6.2.2. Changing the extension
          3. 3.6.2.3. Changing the initial contents
          4. 3.6.2.4. Changing the view
          5. 3.6.2.5. Aptana issues
      7. 3.7. Introducing Komodo Edit
    4. 4. Managing Information with Lists and Tables
      1. 4.1. Making a List and Checking It Twice
        1. 4.1.1. Creating an unordered list
          1. 4.1.1.1. Looking at an unordered list
          2. 4.1.1.2. Building an unordered list
        2. 4.1.2. Creating ordered lists
          1. 4.1.2.1. Viewing an ordered list
          2. 4.1.2.2. Building the ordered list
        3. 4.1.3. Making nested lists
          1. 4.1.3.1. Examining the nested list example
          2. 4.1.3.2. Indenting your code
          3. 4.1.3.3. Building a nested list
        4. 4.1.4. Building the definition list
      2. 4.2. Building Tables
        1. 4.2.1. Defining the table
          1. 4.2.1.1. Adding your first row
          2. 4.2.1.2. Making your data rows
          3. 4.2.1.3. Building tables in the text editor
        2. 4.2.2. Spanning rows and columns
          1. 4.2.2.1. Spanning multiple columns
          2. 4.2.2.2. Spanning multiple rows
        3. 4.2.3. Avoiding the table-based layout trap
    5. 5. Making Connections with Links
      1. 5.1. Making Your Text Hyper
        1. 5.1.1. Introducing the anchor tag
        2. 5.1.2. Comparing block-level and inline elements
        3. 5.1.3. Analyzing an anchor
        4. 5.1.4. Introducing URLs
      2. 5.2. Making Lists of Links
      3. 5.3. Working with Absolute and Relative References
        1. 5.3.1. Understanding absolute references
        2. 5.3.2. Introducing relative references
    6. 6. Adding Images
      1. 6.1. Adding Images to Your Pages
        1. 6.1.1. Adding links to images
        2. 6.1.2. Adding inline images using the <img> tag
          1. 6.1.2.1. src (source)
          2. 6.1.2.2. height and width
          3. 6.1.2.3. alt (alternate text)
      2. 6.2. Choosing an Image Manipulation Tool
        1. 6.2.1. An image is worth 3.4 million words!
        2. 6.2.2. Introducing IrfanView
      3. 6.3. Choosing an Image Format
        1. 6.3.1. BMP
        2. 6.3.2. JPG/JPEG
        3. 6.3.3. GIF
        4. 6.3.4. PNG
        5. 6.3.5. Summary of Web image formats
      4. 6.4. Manipulating Your Images
        1. 6.4.1. Changing formats in IrfanView
        2. 6.4.2. Resizing your images
        3. 6.4.3. Enhancing image colors
        4. 6.4.4. Using built-in effects
        5. 6.4.5. Other effects you can use
        6. 6.4.6. Batch processing
      5. 6.5. Using Images as Links
        1. 6.5.1. Creating thumbnail images
        2. 6.5.2. Creating a thumbnail-based image directory
    7. 7. Creating Forms
      1. 7.1. You Have Great Form
        1. 7.1.1. Forms must have some form
        2. 7.1.2. Organizing a form with fieldsets and labels
      2. 7.2. Building Text-Style Inputs
        1. 7.2.1. Making a standard text field
        2. 7.2.2. Building a password field
        3. 7.2.3. Making multi-line text input
      3. 7.3. Creating Multiple Selection Elements
        1. 7.3.1. Making selections
        2. 7.3.2. Building check boxes
        3. 7.3.3. Creating radio buttons
      4. 7.4. Pressing Your Buttons
        1. 7.4.1. Making input-style buttons
        2. 7.4.2. Building a Submit button
        3. 7.4.3. It's a do-over: The Reset button
        4. 7.4.4. Introducing the <button> tag
    8. 8. The Future of HTML: HTML 5
      1. 8.1. Can't We Just Stick with XHTML?
        1. 8.1.1. Using the HTML 5 doctype
        2. 8.1.2. Browser support for HTML 5
        3. 8.1.3. Validating HTML 5
      2. 8.2. Semantic Elements
      3. 8.3. Using New Form Elements
      4. 8.4. Using Embedded Fonts
      5. 8.5. Audio and Video Tags
      6. 8.6. The Canvas Tag
      7. 8.7. Other Promising Features
      8. 8.8. Limitations of HTML 5
  7. II. Styling with CSS
    1. 1. Coloring Your World
      1. 1.1. Now You Have an Element of Style
        1. 1.1.1. Setting up a style sheet
        2. 1.1.2. Changing the colors
      2. 1.2. Specifying Colors in CSS
        1. 1.2.1. Using color names
        2. 1.2.2. Putting a hex on your colors
        3. 1.2.3. Coloring by number
        4. 1.2.4. Hex education
        5. 1.2.5. Using the Web-safe color palette
      3. 1.3. Choosing Your Colors
        1. 1.3.1. Starting with Web-safe colors
        2. 1.3.2. Modifying your colors
        3. 1.3.3. Doing it on your own pages
        4. 1.3.4. Changing CSS on the fly
      4. 1.4. Creating Your Own Color Scheme
        1. 1.4.1. Understanding hue, saturation, and value
        2. 1.4.2. Using the Color Scheme Designer
        3. 1.4.3. Selecting a base hue
        4. 1.4.4. Picking a color scheme
    2. 2. Styling Text
      1. 2.1. Setting the Font Family
        1. 2.1.1. Applying the font-family style attribute
        2. 2.1.2. Using generic fonts
        3. 2.1.3. Making a list of fonts
      2. 2.2. The Curse of Web-Based Fonts
        1. 2.2.1. Understanding the problem
        2. 2.2.2. Examining possible solutions
        3. 2.2.3. Using images for headlines
      3. 2.3. Specifying the Font Size
        1. 2.3.1. Size is only a suggestion!
        2. 2.3.2. Using the font-size style attribute
        3. 2.3.3. Absolute measurement units
          1. 2.3.3.1. Points (pt)
          2. 2.3.3.2. Pixels (px)
          3. 2.3.3.3. Traditional measurements (in, cm)
        4. 2.3.4. Relative measurement units
          1. 2.3.4.1. Named sizes
          2. 2.3.4.2. Percentage (%)
          3. 2.3.4.3. Em (em)
      4. 2.4. Determining Other Font Characteristics
        1. 2.4.1. Using font-style for italics
        2. 2.4.2. Using font-weight for bold
        3. 2.4.3. Using text-decoration
        4. 2.4.4. Using text-align for basic alignment
        5. 2.4.5. Other text attributes
        6. 2.4.6. Using the font shortcut
        7. 2.4.7. Working with subscripts and superscripts
    3. 3. Selectors, Class, and Style
      1. 3.1. Selecting Particular Segments
        1. 3.1.1. Defining more than one kind of paragraph
        2. 3.1.2. Styling identified paragraphs
      2. 3.2. Using Emphasis and Strong Emphasis
        1. 3.2.1. Adding emphasis to the page
        2. 3.2.2. Modifying the display of em and strong
      3. 3.3. Defining Classes
        1. 3.3.1. Adding classes to the page
        2. 3.3.2. Combining classes
      4. 3.4. Introducing div and span
        1. 3.4.1. Organizing the page by meaning
        2. 3.4.2. Why not make a table?
      5. 3.5. Using Pseudo-Classes to Style Links
        1. 3.5.1. Styling a standard link
        2. 3.5.2. Styling the link states
        3. 3.5.3. Best link practices
      6. 3.6. Selecting in Context
      7. 3.7. Defining Multiple Styles at Once
    4. 4. Borders and Backgrounds
      1. 4.1. Joining the Border Patrol
        1. 4.1.1. Using the border attributes
        2. 4.1.2. Defining border styles
        3. 4.1.3. Using the border shortcut
        4. 4.1.4. Creating partial borders
      2. 4.2. Introducing the Box Model
        1. 4.2.1. Borders, margin, and padding
        2. 4.2.2. Positioning elements with margins and padding
      3. 4.3. Changing the Background Image
        1. 4.3.1. Getting a background check
        2. 4.3.2. Solutions to the background conundrum
          1. 4.3.2.1. Using a tiled image
          2. 4.3.2.2. Getting a tiled image
          3. 4.3.2.3. Setting background colors
          4. 4.3.2.4. Reducing the contrast
      4. 4.4. Manipulating Background Images
        1. 4.4.1. Turning off the repeat
        2. 4.4.2. Making effective gradients with repeat-x and repeat-y
      5. 4.5. Using Images in Lists
    5. 5. Levels of CSS
      1. 5.1. Managing Levels of Style
        1. 5.1.1. Using local styles
          1. 5.1.1.1. When to use local styles
          2. 5.1.1.2. The drawbacks of local styles
        2. 5.1.2. Using an external style sheet
          1. 5.1.2.1. Defining the external style
          2. 5.1.2.2. Reusing an external CSS style
          3. 5.1.2.3. Understanding the link tag
          4. 5.1.2.4. Specifying an external link
      2. 5.2. Understanding the Cascading Part of Cascading Style Sheets
        1. 5.2.1. Inheriting styles
        2. 5.2.2. Hierarchy of styles
        3. 5.2.3. Overriding styles
        4. 5.2.4. Precedence of style definitions
      3. 5.3. Using Conditional Comments
        1. 5.3.1. Coping with incompatibility
        2. 5.3.2. Making Internet Explorer–specific code
        3. 5.3.3. Using a conditional comment with CSS
        4. 5.3.4. Checking the Internet Explorer version
  8. III. Using Positional CSS
    1. 1. Fun with the Fabulous Float
      1. 1.1. Avoiding Old-School Layout Pitfalls
        1. 1.1.1. Problems with frames
        2. 1.1.2. Problems with tables
        3. 1.1.3. Problems with huge images
        4. 1.1.4. Problems with Flash
      2. 1.2. Introducing the Floating Layout Mechanism
        1. 1.2.1. Using float with images
        2. 1.2.2. Adding the float property
      3. 1.3. Using Float with Block-Level Elements
        1. 1.3.1. Floating a paragraph
        2. 1.3.2. Adjusting the width
        3. 1.3.3. Setting the next margin
      4. 1.4. Using Float to Style Forms
        1. 1.4.1. Using float to beautify the form
        2. 1.4.2. Adjusting the fieldset width
        3. 1.4.3. Using the clear attribute to control page layout
    2. 2. Building Floating Page Layouts
      1. 2.1. Creating a Basic Two-Column Design
        1. 2.1.1. Designing the page
        2. 2.1.2. Building the XHTML
        3. 2.1.3. Adding preliminary CSS
        4. 2.1.4. Using temporary borders
        5. 2.1.5. Setting up the floating columns
        6. 2.1.6. Tuning up the borders
        7. 2.1.7. Advantages of a fluid layout
      2. 2.2. Building a Three-Column Design
        1. 2.2.1. Styling the three-column page
        2. 2.2.2. Problems with the floating layout
        3. 2.2.3. Specifying a min-height
      3. 2.3. Building a Fixed-Width Layout
        1. 2.3.1. Setting up the XHTML
        2. 2.3.2. Using an image to simulate true columns
      4. 2.4. Building a Centered Fixed-Width Layout
        1. 2.4.1. Making a surrogate body with an all div
        2. 2.4.2. How the jello layout works
        3. 2.4.3. Limitations of the jello layout
    3. 3. Styling Lists and Menus
      1. 3.1. Revisiting List Styles
        1. 3.1.1. Defining navigation as a list of links
        2. 3.1.2. Turning links into buttons
        3. 3.1.3. Building horizontal lists
      2. 3.2. Creating Dynamic Lists
        1. 3.2.1. Building a nested list
        2. 3.2.2. Hiding the inner lists
        3. 3.2.3. Getting the inner lists to appear on cue
      3. 3.3. Building a Basic Menu System
        1. 3.3.1. Building a vertical menu with CSS
        2. 3.3.2. Building a horizontal menu
    4. 4. Using Alternative Positioning
      1. 4.1. Working with Absolute Positioning
        1. 4.1.1. Setting up the HTML
        2. 4.1.2. Adding position guidelines
        3. 4.1.3. Making absolute positioning work
      2. 4.2. Managing z-index
        1. 4.2.1. Handling depth
        2. 4.2.2. Working with z-index
      3. 4.3. Building a Page Layout with Absolute Positioning
        1. 4.3.1. Overview of absolute layout
        2. 4.3.2. Writing the XHTML
        3. 4.3.3. Adding the CSS
      4. 4.4. Creating a More Flexible Layout
        1. 4.4.1. Designing with percentages
        2. 4.4.2. Building the layout
      5. 4.5. Exploring Other Types of Positioning
        1. 4.5.1. Creating a fixed menu system
        2. 4.5.2. Setting up the XHTML
        3. 4.5.3. Setting the CSS values
      6. 4.6. Determining Your Layout Scheme
  9. IV. Client-Side Programming with JavaScript
    1. 1. Getting Started with JavaScript
      1. 1.1. Working in JavaScript
        1. 1.1.1. Choosing a JavaScript editor
        2. 1.1.2. Picking your test browser
      2. 1.2. Writing Your First JavaScript Program
        1. 1.2.1. Embedding your JavaScript code
        2. 1.2.2. Creating comments
        3. 1.2.3. Using the alert() method for output
        4. 1.2.4. Adding the semicolon
      3. 1.3. Introducing Variables
        1. 1.3.1. Creating a variable for data storage
        2. 1.3.2. Asking the user for information
        3. 1.3.3. Responding to the user
      4. 1.4. Using Concatenation to Build Better Greetings
        1. 1.4.1. Comparing literals and variables
        2. 1.4.2. Including spaces in your concatenated phrases
      5. 1.5. Understanding the String Object
        1. 1.5.1. Introducing object-based programming (and cows)
        2. 1.5.2. Investigating the length of a string
        3. 1.5.3. Using string methods to manipulate text
      6. 1.6. Understanding Variable Types
        1. 1.6.1. Adding numbers
        2. 1.6.2. Adding the user's numbers
        3. 1.6.3. The trouble with dynamic data
        4. 1.6.4. The pesky plus sign
      7. 1.7. Changing Variables to the Desired Type
        1. 1.7.1. Using variable conversion tools
        2. 1.7.2. Fixing the addInput code
    2. 2. Making Decisions with Conditions
      1. 2.1. Working with Random Numbers
        1. 2.1.1. Creating an integer within a range
        2. 2.1.2. Building a program that rolls dice
      2. 2.2. Using if to Control Flow
        1. 2.2.1. The basic if statement
        2. 2.2.2. All about conditions
        3. 2.2.3. Comparison operators
      3. 2.3. Using the else Clause
        1. 2.3.1. Using if-else for more complex interaction
        2. 2.3.2. Solving the mystery of the unnecessary else
      4. 2.4. Using switch for More Complex Branches
        1. 2.4.1. Creating an expression
        2. 2.4.2. Switching with style
      5. 2.5. Nesting if Statements
        1. 2.5.1. Building the nested conditions
        2. 2.5.2. Making sense of nested ifs
    3. 3. Loops and Debugging
      1. 3.1. Building Counting Loops with for
        1. 3.1.1. Building a standard for loop
        2. 3.1.2. Counting backward
        3. 3.1.3. Counting by 5
      2. 3.2. Looping for a while
        1. 3.2.1. Creating a basic while loop
        2. 3.2.2. Avoiding loop mistakes
      3. 3.3. Introducing Bad Loops
        1. 3.3.1. Managing the reluctant loop
        2. 3.3.2. Managing the obsessive loop
      4. 3.4. Debugging Your Code
        1. 3.4.1. Letting Aptana help
        2. 3.4.2. Debugging JavaScript on Internet Explorer
        3. 3.4.3. Finding errors in Firefox
        4. 3.4.4. Finding errors with Firebug
      5. 3.5. Catching Logic Errors
        1. 3.5.1. Logging to the console with Firebug
        2. 3.5.2. Looking at console output
      6. 3.6. Using the Interactive Debug Mode
        1. 3.6.1. Setting up the Firebug debugger
        2. 3.6.2. Setting a breakpoint
        3. 3.6.3. Adding a debugger directive
        4. 3.6.4. Examining debug mode
        5. 3.6.5. Debugging your code
    4. 4. Functions, Arrays, and Objects
      1. 4.1. Breaking Code into Functions
        1. 4.1.1. Thinking about structure
        2. 4.1.2. Building the antsFunction.html program
      2. 4.2. Passing Data to and from Functions
        1. 4.2.1. Examining the main code
        2. 4.2.2. Looking at the chorus
        3. 4.2.3. Handling the verses
          1. 4.2.3.1. Passing data to the verse() function
          2. 4.2.3.2. Determining the distraction
          3. 4.2.3.3. Creating the text
      3. 4.3. Managing Scope
        1. 4.3.1. Introducing local and global variables
        2. 4.3.2. Examining variable scope
      4. 4.4. Building a Basic Array
        1. 4.4.1. Accessing array data
        2. 4.4.2. Using arrays with for loops
        3. 4.4.3. Revisiting the ants song
      5. 4.5. Working with Two-Dimension Arrays
        1. 4.5.1. Setting up the arrays
        2. 4.5.2. Getting a city
        3. 4.5.3. Creating a main() function
      6. 4.6. Creating Your Own Objects
        1. 4.6.1. Building a basic object
        2. 4.6.2. Adding methods to an object
        3. 4.6.3. Building a reusable object
        4. 4.6.4. Using your shiny new objects
      7. 4.7. Introducing JSON
        1. 4.7.1. Storing data in JSON format
        2. 4.7.2. Building a more complex JSON structure
    5. 5. Talking to the Page
      1. 5.1. Understanding the Document Object Model
        1. 5.1.1. Navigating the DOM
        2. 5.1.2. Changing DOM properties with Firebug
        3. 5.1.3. Examining the document object
      2. 5.2. Harnessing the DOM through JavaScript
        1. 5.2.1. Getting the blues, JavaScript-style
        2. 5.2.2. Writing JavaScript code to change colors
      3. 5.3. Managing Button Events
        1. 5.3.1. Embedding quotes within quotes
        2. 5.3.2. Writing the changeColor function
      4. 5.4. Managing Text Input and Output
        1. 5.4.1. Introducing event-driven programming
        2. 5.4.2. Creating the XHTML form
        3. 5.4.3. Using GetElementById to get access to the page
        4. 5.4.4. Manipulating the text fields
      5. 5.5. Writing to the Document
        1. 5.5.1. Preparing the HTML framework
        2. 5.5.2. Writing the JavaScript
        3. 5.5.3. Finding your innerHTML
      6. 5.6. Working with Other Text Elements
        1. 5.6.1. Building the form
        2. 5.6.2. Writing the function
        3. 5.6.3. Understanding generated source
    6. 6. Getting Valid Input
      1. 6.1. Getting Input from a Drop-Down List
        1. 6.1.1. Building the form
        2. 6.1.2. Reading the list box
      2. 6.2. Managing Multiple Selections
        1. 6.2.1. Coding a multiple selection select object
        2. 6.2.2. Writing the JavaScript code
      3. 6.3. Check, Please: Reading Check Boxes
        1. 6.3.1. Building the check box page
        2. 6.3.2. Responding to the check boxes
      4. 6.4. Working with Radio Buttons
        1. 6.4.1. Interpreting radio buttons
      5. 6.5. Working with Regular Expressions
        1. 6.5.1. Introducing regular expressions
        2. 6.5.2. Using characters in regular expressions
        3. 6.5.3. Marking the beginning and end of the line
        4. 6.5.4. Working with special characters
        5. 6.5.5. Conducting repetition operations
        6. 6.5.6. Working with pattern memory
    7. 7. Animating Your Pages
      1. 7.1. Making Things Move
        1. 7.1.1. Looking over the HTML
        2. 7.1.2. Getting an overview of the JavaScript
        3. 7.1.3. Creating global variables
        4. 7.1.4. Initializing
        5. 7.1.5. Moving the sprite
        6. 7.1.6. Checking the boundaries
      2. 7.2. Reading Input from the Keyboard
        1. 7.2.1. Building the keyboard page
        2. 7.2.2. Overwriting the init() function
        3. 7.2.3. Setting up an event handler
        4. 7.2.4. Responding to keystrokes
        5. 7.2.5. Deciphering the mystery of key codes
      3. 7.3. Following the Mouse
        1. 7.3.1. Looking over the HTML
        2. 7.3.2. Initializing the code
        3. 7.3.3. Building the mouse listener
      4. 7.4. Creating Automatic Motion
        1. 7.4.1. Creating a setInterval() call
      5. 7.5. Building Image-Swapping Animation
        1. 7.5.1. Preparing the images
        2. 7.5.2. Building the page
        3. 7.5.3. Building the global variables
        4. 7.5.4. Setting up the interval
        5. 7.5.5. Animating the sprite
      6. 7.6. Preloading Your Images
        1. 7.6.1. Movement and swapping
        2. 7.6.2. Building the code
        3. 7.6.3. Defining global variables
        4. 7.6.4. Initializing your data
        5. 7.6.5. Preloading the images
        6. 7.6.6. Animating and updating the image
        7. 7.6.7. Moving the sprite
  10. V. Server-Side Programming with PHP
    1. 1. Getting Started on the Server
      1. 1.1. Introducing Server-Side Programming
        1. 1.1.1. Programming on the server
        2. 1.1.2. Serving your programs
        3. 1.1.3. Picking a language
          1. 1.1.3.1. ASP.NET
          2. 1.1.3.2. Java
          3. 1.1.3.3. PHP
      2. 1.2. Installing Your Web Server
      3. 1.3. Inspecting phpinfo()
      4. 1.4. Building XHTML with PHP
      5. 1.5. Coding with Quotation Marks
      6. 1.6. Working with Variables PHP-Style
        1. 1.6.1. Concatenation
        2. 1.6.2. Interpolating variables into text
      7. 1.7. Building XHTML Output
        1. 1.7.1. Using double quote interpolation
        2. 1.7.2. Generating output with heredocs
        3. 1.7.3. Switching from PHP to XHTML
    2. 2. PHP and XHTML Forms
      1. 2.1. Exploring the Relationship between PHP and XHTML
        1. 2.1.1. Embedding PHP inside XHTML
        2. 2.1.2. Viewing the results
      2. 2.2. Sending Data to a PHP Program
        1. 2.2.1. Creating a form for PHP processing
        2. 2.2.2. Receiving data in PHP
      3. 2.3. Choosing the Method of Your Madness
        1. 2.3.1. Using get to send data
        2. 2.3.2. Using the post method to transmit form data
        3. 2.3.3. Getting data from the form
      4. 2.4. Retrieving Data from Other Form Elements
        1. 2.4.1. Building a form with complex elements
        2. 2.4.2. Responding to a complex form
    3. 3. Control Structures
      1. 3.1. Introducing Conditions (Again)
      2. 3.2. Building the Classic if Statement
        1. 3.2.1. Rolling dice the PHP way
        2. 3.2.2. Checking your six
        3. 3.2.3. Understanding comparison operators
        4. 3.2.4. Taking the middle road
        5. 3.2.5. Building a program that makes its own form
      3. 3.3. Making a switch
      4. 3.4. Looping with for
      5. 3.5. Looping with while
    4. 4. Working with Arrays
      1. 4.1. Using One-Dimensional Arrays
        1. 4.1.1. Creating an array
        2. 4.1.2. Filling an array
        3. 4.1.3. Viewing the elements of an array
        4. 4.1.4. Preloading an array
      2. 4.2. Using Loops with Arrays
        1. 4.2.1. Simplifying loops with foreach
        2. 4.2.2. Arrays and HTML
      3. 4.3. Introducing Associative Arrays
        1. 4.3.1. Using foreach with associative arrays
      4. 4.4. Introducing Multidimensional Arrays
        1. 4.4.1. We're going on a trip
        2. 4.4.2. Looking up the distance
      5. 4.5. Breaking a String into an Array
        1. 4.5.1. Creating arrays with explode
        2. 4.5.2. Creating arrays with preg_split
    5. 5. Using Functions and Session Variables
      1. 5.1. Creating Your Own Functions
        1. 5.1.1. Rolling dice the old-fashioned way
        2. 5.1.2. Improving code with functions
        3. 5.1.3. Managing variable scope
        4. 5.1.4. Returning data from functions
      2. 5.2. Managing Persistence with Session Variables
        1. 5.2.1. Understanding session variables
        2. 5.2.2. Adding session variables to your code
    6. 6. Working with Files and Directories
      1. 6.1. Text File Manipulation
        1. 6.1.1. Writing text to files
          1. 6.1.1.1. fopen()
          2. 6.1.1.2. fwrite()
          3. 6.1.1.3. fclose()
        2. 6.1.2. Writing a basic text file
        3. 6.1.3. Reading from the file
      2. 6.2. Using Delimited Data
        1. 6.2.1. Storing data in a CSV file
        2. 6.2.2. Viewing CSV data directly
        3. 6.2.3. Reading the CSV data in PHP
      3. 6.3. Working with File and Directory Functions
        1. 6.3.1. opendir()
        2. 6.3.2. readdir()
        3. 6.3.3. chdir()
        4. 6.3.4. Generating the list of file links
    7. 7. Connecting to a MySQL Database
      1. 7.1. Retrieving Data from a Database
        1. 7.1.1. Understanding data connections
        2. 7.1.2. Building a connection
        3. 7.1.3. Passing a query to the database
        4. 7.1.4. Processing the results
        5. 7.1.5. Extracting the rows
        6. 7.1.6. Extracting fields from a row
        7. 7.1.7. Printing the data
      2. 7.2. Improving the Output Format
        1. 7.2.1. Building definition lists
        2. 7.2.2. Using XHTML tables for output
      3. 7.3. Allowing User Interaction
        1. 7.3.1. Building an XHTML search form
        2. 7.3.2. Responding to the search request
        3. 7.3.3. Breaking the code into functions
        4. 7.3.4. Processing the input
        5. 7.3.5. Generating the output
  11. VI. Managing Data with MySQL
    1. 1. Getting Started with Data
      1. 1.1. Examining the Basic Structure of Data
        1. 1.1.1. Determining the fields in a record
        2. 1.1.2. Introducing SQL data types
        3. 1.1.3. Specifying the length of a record
        4. 1.1.4. Defining a primary key
        5. 1.1.5. Defining the table structure
      2. 1.2. Introducing MySQL
        1. 1.2.1. Why use MySQL?
        2. 1.2.2. Understanding the three-tier architecture
        3. 1.2.3. Practicing with MySQL
      3. 1.3. Setting Up phpMyAdmin
        1. 1.3.1. Changing the root password
        2. 1.3.2. Adding a user
        3. 1.3.3. Using phpMyAdmin on a remote server
      4. 1.4. Making a Database with phpMyAdmin
    2. 2. Managing Data with SQL
      1. 2.1. Writing SQL Code by Hand
        1. 2.1.1. Understanding SQL syntax rules
        2. 2.1.2. Examining the buildContact.sql script
        3. 2.1.3. Dropping a table
        4. 2.1.4. Creating a table
        5. 2.1.5. Adding records to the table
        6. 2.1.6. Viewing the sample data
      2. 2.2. Running a Script with phpMyAdmin
      3. 2.3. Using AUTO_INCREMENT for Primary Keys
      4. 2.4. Selecting Data from Your Tables
        1. 2.4.1. Selecting only a few fields
        2. 2.4.2. Selecting a subset of records
        3. 2.4.3. Searching with partial information
        4. 2.4.4. Searching for the ending value of a field
        5. 2.4.5. Searching for any text in a field
        6. 2.4.6. Searching with regular expressions
        7. 2.4.7. Sorting your responses
      5. 2.5. Editing Records
        1. 2.5.1. Updating a record
        2. 2.5.2. Deleting a record
      6. 2.6. Exporting Your Data and Structure
        1. 2.6.1. Exporting SQL code
        2. 2.6.2. Creating XML data
    3. 3. Normalizing Your Data
      1. 3.1. Recognizing Problems with Single-Table Data
        1. 3.1.1. The identity crisis
        2. 3.1.2. The listed powers
        3. 3.1.3. Repetition and reliability
        4. 3.1.4. Fields that change
        5. 3.1.5. Deletion problems
      2. 3.2. Introducing Entity-Relationship Diagrams
        1. 3.2.1. Using MySQL Workbench to draw ER diagrams
        2. 3.2.2. Creating a table definition in Workbench
      3. 3.3. Introducing Normalization
        1. 3.3.1. First normal form
        2. 3.3.2. Second normal form
        3. 3.3.3. Third normal form
      4. 3.4. Identifying Relationships in Your Data
    4. 4. Putting Data Together with Joins
      1. 4.1. Calculating Virtual Fields
        1. 4.1.1. Introducing SQL Functions
        2. 4.1.2. Knowing when to calculate virtual fields
      2. 4.2. Calculating Date Values
        1. 4.2.1. Using DATEDIFF to determine age
        2. 4.2.2. Adding a calculation to get years
        3. 4.2.3. Converting the days integer into a date
        4. 4.2.4. Using YEAR() and MONTH() to get readable values
        5. 4.2.5. Concatenating to make one field
      3. 4.3. Creating a View
      4. 4.4. Using an Inner Join to Combine Tables
        1. 4.4.1. Building a Cartesian join and an inner join
        2. 4.4.2. Enforcing one-to-many relationships
        3. 4.4.3. Counting the advantages of inner joins
        4. 4.4.4. Building a view to encapsulate the join
      5. 4.5. Managing Many-to-Many Joins
        1. 4.5.1. Understanding link tables
        2. 4.5.2. Using link tables to make many-to-many joins
  12. VII. Into the Future with AJAX
    1. 1. AJAX Essentials
      1. 1.1. AJAX Spelled Out
        1. 1.1.1. A is for asynchronous
        2. 1.1.2. J is for JavaScript
        3. 1.1.3. A is for . . . and?
        4. 1.1.4. And X is for . . . data
      2. 1.2. Making a Basic AJAX Connection
        1. 1.2.1. Building the HTML form
        2. 1.2.2. Creating an XMLHttpRequest object
        3. 1.2.3. Opening a connection to the server
        4. 1.2.4. Sending the request and parameters
        5. 1.2.5. Checking the status
      3. 1.3. All Together Now — Making the Connection Asynchronous
        1. 1.3.1. Setting up the program
        2. 1.3.2. Building the getAJAX() function
        3. 1.3.3. Reading the response
    2. 2. Improving JavaScript and AJAX with jQuery
      1. 2.1. Introducing jQuery
        1. 2.1.1. Installing jQuery
        2. 2.1.2. Importing jQuery from Google
      2. 2.2. Your First jQuery App
        1. 2.2.1. Setting up the page
        2. 2.2.2. Meet the jQuery node object
          1. 2.2.2.1. Creating a jQuery object
          2. 2.2.2.2. Enjoying your new jQuery node object
      3. 2.3. Creating an Initialization Function
        1. 2.3.1. Using $(document).ready()
        2. 2.3.2. Alternatives to document.ready
      4. 2.4. Investigating the jQuery Object
        1. 2.4.1. Changing the style of an element
        2. 2.4.2. Selecting jQuery objects
        3. 2.4.3. Modifying the style
      5. 2.5. Adding Events to Objects
        1. 2.5.1. Adding a hover event
        2. 2.5.2. Changing classes on the fly
      6. 2.6. Making an AJAX Request with jQuery
        1. 2.6.1. Including a text file with AJAX
        2. 2.6.2. Building a poor man's CMS with AJAX
    3. 3. Animating jQuery
      1. 3.1. Playing Hide and Seek
        1. 3.1.1. Getting transition support
        2. 3.1.2. Writing the HTML and CSS foundation
        3. 3.1.3. Initializing the page
        4. 3.1.4. Hiding and showing the content
        5. 3.1.5. Toggling visibility
        6. 3.1.6. Sliding an element
        7. 3.1.7. Fading an element in and out
      2. 3.2. Changing Position with jQuery
        1. 3.2.1. Creating the framework
        2. 3.2.2. Setting up the events
        3. 3.2.3. Don't go chaining . . . okay, do it all you want
        4. 3.2.4. Building the move() function with chaining
        5. 3.2.5. Building time-based animation with animate()
        6. 3.2.6. Move a little bit: Relative motion
      3. 3.3. Modifying Elements on the Fly
        1. 3.3.1. Building the basic page
        2. 3.3.2. Initializing the code
        3. 3.3.3. Adding text
        4. 3.3.4. Attack of the clones
        5. 3.3.5. It's a wrap
        6. 3.3.6. Alternating styles
        7. 3.3.7. Resetting the page
        8. 3.3.8. More fun with selectors and filters
    4. 4. Using the jQuery User Interface Toolkit
      1. 4.1. What the jQuery User Interface Brings to the Table
        1. 4.1.1. It's a theme park
        2. 4.1.2. Using the themeRoller to get an overview of jQuery
        3. 4.1.3. Wanna drag? Making components draggable
        4. 4.1.4. Downloading the library
        5. 4.1.5. Writing the program
      2. 4.2. Resizing on a Theme
        1. 4.2.1. Examining the HTML and standard CSS
        2. 4.2.2. Importing the files
        3. 4.2.3. Making a resizable element
        4. 4.2.4. Adding themes to your elements
        5. 4.2.5. Adding an icon
      3. 4.3. Dragging, Dropping, and Calling Back
        1. 4.3.1. Building the basic page
        2. 4.3.2. Initializing the page
        3. 4.3.3. Handling the drop
        4. 4.3.4. Beauty school dropout events
        5. 4.3.5. Cloning the elements
    5. 5. Improving Usability with jQuery
      1. 5.1. Multi-element Designs
        1. 5.1.1. Playing the accordion widget
        2. 5.1.2. Building a tabbed interface
        3. 5.1.3. Using tabs with AJAX
      2. 5.2. Improving Usability
        1. 5.2.1. Playing the dating game
        2. 5.2.2. Picking numbers with the slider
        3. 5.2.3. Selectable elements
        4. 5.2.4. Building a sortable list
        5. 5.2.5. Creating a custom dialog box
    6. 6. Working with AJAX Data
      1. 6.1. Sending Requests AJAX Style
        1. 6.1.1. Sending the data
        2. 6.1.2. Simplifying PHP for AJAX
      2. 6.2. Building a Multipass Application
        1. 6.2.1. Setting up the HTML framework
        2. 6.2.2. Loading the select element
        3. 6.2.3. Writing the loadList.php program
        4. 6.2.4. Responding to selections
        5. 6.2.5. Writing the showHero.php script
      3. 6.3. Working with XML Data
        1. 6.3.1. Review of XML
        2. 6.3.2. Manipulating XML with jQuery
        3. 6.3.3. Creating the HTML
        4. 6.3.4. Retrieving the data
        5. 6.3.5. Processing the results
        6. 6.3.6. Printing the pet name
      4. 6.4. Working with JSON Data
        1. 6.4.1. Knowing JSON's pros
        2. 6.4.2. Reading JSON data with jQuery
        3. 6.4.3. Managing the framework
        4. 6.4.4. Retrieving the JSON data
        5. 6.4.5. Processing the results
  13. VIII. Moving from Pages to Sites
    1. 1. Managing Your Servers
      1. 1.1. Understanding Clients and Servers
        1. 1.1.1. Parts of a client-side development system
        2. 1.1.2. Parts of a server-side system
      2. 1.2. Creating Your Own Server with XAMPP
        1. 1.2.1. Running XAMPP
        2. 1.2.2. Testing your XAMPP configuration
        3. 1.2.3. Adding your own files
        4. 1.2.4. Setting the security level
        5. 1.2.5. Compromising between functionality and security
      3. 1.3. Choosing a Web Host
        1. 1.3.1. Finding a hosting service
        2. 1.3.2. Connecting to a hosting service
      4. 1.4. Managing a Remote Site
        1. 1.4.1. Using Web-based file tools
        2. 1.4.2. Understanding file permissions
        3. 1.4.3. Using FTP to manage your site
      5. 1.5. Naming Your Site
        1. 1.5.1. Understanding domain names
        2. 1.5.2. Registering a domain name
      6. 1.6. Managing Data Remotely
        1. 1.6.1. Creating your database
        2. 1.6.2. Finding the MySQL server name
    2. 2. Planning Your Sites
      1. 2.1. Creating a Multipage Web Site
      2. 2.2. Planning a Larger Site
      3. 2.3. Understanding the Client
        1. 2.3.1. Ensuring that the client's expectations are clear
        2. 2.3.2. Delineating the tasks
      4. 2.4. Understanding the Audience
        1. 2.4.1. Determining whom you want to reach
        2. 2.4.2. Finding out the user's technical expertise
      5. 2.5. Building a Site Plan
        1. 2.5.1. Creating a site overview
        2. 2.5.2. Building the site diagram
      6. 2.6. Creating Page Templates
        1. 2.6.1. Sketching the page design
        2. 2.6.2. Building the XHTML template framework
        3. 2.6.3. Creating page styles
        4. 2.6.4. Building a data framework
      7. 2.7. Fleshing Out the Project
        1. 2.7.1. Making the site live
        2. 2.7.2. Contemplating efficiency
    3. 3. Introducing Content Management Systems
      1. 3.1. Overview of Content Management Systems
      2. 3.2. Previewing Common CMSs
        1. 3.2.1. Moodle
        2. 3.2.2. WordPress
        3. 3.2.3. Drupal
        4. 3.2.4. Building a CMS site with Website Baker
        5. 3.2.5. Installing your CMS
        6. 3.2.6. Getting an overview of Website Baker
        7. 3.2.7. Adding your content
        8. 3.2.8. Using the WYSIWYG editor
        9. 3.2.9. Changing the template
        10. 3.2.10. Adding additional templates
        11. 3.2.11. Adding new functionality
      3. 3.3. Building Custom Themes
        1. 3.3.1. Starting with a prebuilt template
        2. 3.3.2. Changing the info.php file
        3. 3.3.3. Modifying index.php
        4. 3.3.4. Modifying the CSS files
        5. 3.3.5. Packaging your template
    4. 4. Editing Graphics
      1. 4.1. Using a Graphic Editor
        1. 4.1.1. Choosing an editor
      2. 4.2. Introducing Gimp
        1. 4.2.1. Creating an image
        2. 4.2.2. Painting tools
        3. 4.2.3. Selection tools
        4. 4.2.4. Modification tools
        5. 4.2.5. Managing tool options
        6. 4.2.6. Utilities
      3. 4.3. Understanding Layers
      4. 4.4. Introducing Filters
      5. 4.5. Solving Common Web Graphics Problems
        1. 4.5.1. Changing a color
        2. 4.5.2. Building a banner graphic
        3. 4.5.3. Building a tiled background
    5. 5. Taking Control of Content
      1. 5.1. Building a "Poor Man's CMS" with Your Own Code
        1. 5.1.1. Using Server-Side Includes (SSIs)
        2. 5.1.2. Using AJAX and jQuery for client-side inclusion
        3. 5.1.3. Building a page with PHP includes
      2. 5.2. Creating Your Own Data-Based CMS
        1. 5.2.1. Using a database to manage content
        2. 5.2.2. Writing a PHP page to read from the table
        3. 5.2.3. Allowing user-generated content
        4. 5.2.4. Adding a new block
        5. 5.2.5. Improving the dbCMS design
  14. A. What's on the CD
    1. A.1. System Requirements
    2. A.2. Using the CD
    3. A.3. What You'll Find on the CD
      1. A.3.1. Author-created material
      2. A.3.2. Aptana Studio 2.0
      3. A.3.3. Dia 0.97.1
      4. A.3.4. FileZilla 3.3.1
      5. A.3.5. Firefox 3.6 and Extensions
      6. A.3.6. GIMP 2.6
      7. A.3.7. HTML Tidy
      8. A.3.8. IrfanView 4.25
      9. A.3.9. IZArc 4.1
      10. A.3.10. jEdit
      11. A.3.11. jQuery 1.4
      12. A.3.12. Komodo Edit
      13. A.3.13. KompoZer 0.7.10
      14. A.3.14. Notepad++
      15. A.3.15. SQLite 3.6.22
      16. A.3.16. WebsiteBaker 2.8.1
      17. A.3.17. XAMPP 1.7.3
      18. A.3.18. XnView 1.97
    4. A.4. Troubleshooting
      1. A.4.1. Customer Care

Product information

  • Title: HTML, XHTML, & CSS All-in-One For Dummies®, 2nd Edition
  • Author(s):
  • Release date: November 2010
  • Publisher(s): For Dummies
  • ISBN: 9780470537558