|
|
|
This is a series of simple examples of HTML pages. For some good explanations of HTML see Raggett's 10 Minute Guide to HTML and the W3C's HTML 4.0 Home Page. O'Reilly also has a good html book. To see how each page is coded, right-click on the page, and choose "View Source". You'll note the html "commands" are always enclosed in angle brackets. These angle-enclosed items are called "tags". Here's
a listing of all HTML tags. Of course you can get a good html editor for free these days (Front Page Express is included free with Microsoft Internet Explorer, and Netscape Composer is free from Netscape) but knowing how to write code directly can still be useful, especially when adding active elements with DHTML. Getting Started: To create your own images, including soft shadow text and animated GIFs, a good, inexpensive program is PaintShop Pro. Meta Content: Using the body tag, you can specify background color, background image,
and other attributes. Colors: The way to to separate the content from the formatting is to use HTML for content description only, and to use "Cascading Style Sheets" to specify document formatting. Here's a few examples (more coming at some point here...). The style sheet info in these examples is in enclosed in the <STYLE> tag, but you can put the style info in another file and refer to it from multiple pages. Style Sheet example 1: The body tag. BTW, "Cascading Style Sheets" are called "Cascading" because you can apply multiple style declarations to a single element, in which case the last specified style takes precedence. Also, multiple style items can each specify different aspects, in which case they are combined. More on style sheets: Check out the Microsoft web authoring site listed
at the top of this page. Client Side Examples: These run in the
web page on the client, so you can see the script with View Source (right-click
on page). All of the examples above except the first one will actually run only
in IE4 or later, at least at the time of this writing. This is because
they are demonstrations not just of the JScript language which is found
in IE4 and Netscape (in Netscape it is called JavaScript), but also of
the Document Object Model, first implemented in IE4 but proposed to the
W3C and soon to be a standard. With the Document Object Model (apparently
now called the Dynamic HTML Object Model), you don't just have a simple
scripting language in the page with the ability to manipulate a few elements,
the script can work on any page element or group of elements. The elements
also can have behaviors and attributes attached to them, for example:
window.close. In example 4, an element is given the name "NumberText".
You can then change the innerHTML property of the element from
a script in the page. And, any element can respond to just about any event
(like onClick). For more examples of JScript in particular, check out the Mining Co JavaScript site. Microsoft also has a comprehensive JScript site. You can generally copy examples from any site and paste them into your own pages, so it is often not necessary to write an entire script from scratch. If there are copyright restrictions on the script, it will say so in the source, in which case you can still use the script as an example for learning how to write your own. Server Side Examples: These run on the
server, so to display the source, I gave them an extra .TXT extension.
Copy them to your web server, remove the TXT extension and then view them
in your browser. Server Side Includes allow you to include other files in a given
html file. This means you can do things like put a document footer in
all of the pages on your site. When you want to change the footer you
can just change that one file instead of editing all of the pages on your
site. (There are better ways to do this, like for example the Dreamweaver
Library feature. Using SSI makes your server work harder.) Here is one simple example: Here is a very simple example of using the Request and Response objects:
(copy these to your server and run them). ASP example 3: Display the source code of another page. (Requires ASP2HTM, available in the IIS Resource Kit. The Resource Kit also has more examples.) This displays the source of another page with the tags in blue and the text in black. Anyone want to work on this and make it more useful? (Like for example provide an input page and format the output more nicely.) A few more asp examples: Tidy (Utility for cleaning up HTML) Last update 3/7/00 copyright © 2000 Joe Orr NYCircuits Inc. MCSE Class Homepage |