HTML The Definitive Guide (19 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
2.45Mb size Format: txt, pdf, ePub

Frames are defined in a special HTML document in which you replace the tag with one or more tags that tell the browser how to divide its main window into discrete frames.

Special tags go inside the tag and point to the documents that go inside the frames.

The individual documents referenced and displayed in the frame document window act independently, to a degree; the frame document controls the entire window. You can, however, direct one frame's document to load new content into another frame. Selecting an item from a table of contents, for example, might cause the browser to load and display the referenced document into an adjacent frame for viewing. That way, the table of contents always is available to the user as he or she browses the collection.

2.10 Tables

2.12 Style Sheets and

JavaScript

Chapter 2

HTML Quick Start

 

2.12 Style Sheets and JavaScript

The very latest browsers also have support for two powerful innovations to HTML: style sheets and JavaScript. Like their desktop-publishing cousins, style sheets let you control how your HTML pages look - text font styles and sizes, colors, backgrounds, alignments, and so on. More importantly, style sheets give you a way to impose display characteristics uniformly over the entire document and over an entire collection of documents.

JavaScript is a programming language with functions and commands that let you control how the browser behaves for the user. Now, this is not a programming book, but there are two reasons we mention JavaScript here and cover the language in fair detail in later chapters. First, you embed JavaScript programs directly into your HTML documents to achieve some very powerful and fun effects. Second, it is through JavaScript that the folks at Netscape also implement style sheets in their latest browser.

The World Wide Web Consortium - the putative standards organization - prefers that you use the Cascading Style Sheets (CSS) model for HTML document design. The latest versions of Netscape and Internet Explorer (both Version 4 at the time we wrote this book) support CSS and JavaScript, but only Netscape supports JavaScript-based Style Sheets ( JSS).

To illustrate the differences between CSS and JSS, here are the two ways you can make all the top-level (H1) header text in your HTML document appear in the color red. First, using CSS:


CSS Example




I'll be red if your browser supports CSS

Something in between.

I should be red, too!



Using JSS:



JSS Example




I'll be red if your browser supports JSS

Something in between.

I should be red, too!



The examples are nearly identical, but the devil is in the details. Both have their own peculiar syntax that is unfamiliar to most everyone except programmers. The nastiest detail, however, and one that will drive many an HTML author batty, is that JSS, like its parent JavaScript language, is case-sensitive - type "h1" instead of "H1" in the style description and you ain't gonna see red. Type "h1" in the CSS style description (or in the tag, for that matter) and it still works.

Other books

Death's Academy by Bast, Michael
Black by Aria Cole
New Taboos by John Shirley
Pox by Michael Willrich
Repent in Love by J. Hali Steele
Skinwalker by Faith Hunter