Here are all the COMPLETE code examples, available for cut-and-paste, out of "HTML & XHTML: The Definitive Guide". In many cases URLs and pathnames will need to be changed (see pages 27, 187-188). The URL http://www.kumquats.com/ is in no way associated with the authors or O'Reilly & Associates. This URL is merely used to serve as an example. If you are using Windows, use Notepad as your text editor. Make sure to save your file with the ".html" extension, and change "Save as type:" to "All Files". ================= Pages 17-18 ================= My first HTML document

My first HTML document

Hello, World Wide Web!

Greetings from
O'Reilly & Associates

Composed with care by: (insert your name here)
©2000 and beyond ================= Pages 36-37 ================= CSS Example

I'll be red if your browser supports CSS

Something in between.

I should be red, too!

================= Page 40 ================= Barebones HTML Document This illustrates, in a very simple way, the basic structure of an HTML document. ================= Page 49 ================= Display Directions This is how IE 5 renders right-to-left directed text. ================= Page 53 ================= HTML and XHTML: The Definitive Guide ================= Page 215 ================= Kumquat Advice Database

Kumquat Advice Database

Search this database to learn more about kumquats! ================= Page 252 gen_styles.css ================= h1 {color:blue; font-style: italic} ================= Page 253 ================= Style linked

I'm so bluuuuoooo!

...

I am ba-loooooo, tooooo!

================= Pages 253-254 ================= Imported style sheet ================= Page 256 ================= ================= Pages 351-352 ================= #include #include #define MAX_ENTRIES 10000 typedef struct {char *name; char *val; }entry; char *makeword(char *line, char stop); char x2c(char *what); void unescape_url(char *url); void plustospace(char *str); main(int argc, char *argv[]) { entry entries[MAX_ENTRIES]; int num_entries, i; char *query_string; /* Get the value of the QUERY_STRING environment variable */ query_string = getenv("QUERY_STRING"); /* Extract the parameters, building a table of entries */ for (num_entries = 0; query_string[0]; num_entries++) { entries[num_entries].val = makeword(query_string, '&'); plustospace(entries[num_entries].val); unescape_url(entries[num_entries].val); entries[num_entries].name = makeword(entries[num_entries].val, '='); } /* Spit out the HTML boilerplate */ printf("Content-type: text/html\n"); printf("\n"); printf(""); printf(""); printf("Named Parameter Echo\n"); printf(""); printf(""); printf("You entered the following parameters:\n"); printf("
    \n"); /* Echo the parameters back to the user */ for(i = 0; i < num_entries; i++) printf("
  • %s = %s\n", entries[i].name, entries[i].val); /* And close out with more boilerplate */ printf("
\n"); printf("\n"); printf("\n"); } ================= Page 353 ================= #!/bin/csh -f # # Dump unnamed GET parameters back to the user echo "Content-type: text/html" echo echo '' echo '' echo 'Unnamed Parameter Echo' echo '' echo '' echo 'You entered the following parameters:' echo '
    ' foreach i ($*) echo '
  • ' $i end echo '
' echo '' exit 0 ================= Pages 353-354 ================= #include #include #define MAX_ENTRIES 10000 typedef struct {char *name; char *val; } entry; char *makeword(char *line, char stop); char *fmakeword(FILE *f, char stop, int *len); char x2c(char *what); void unescape_url(char *url); void plustospace(char *str); main(int argc, char *argv[]) { entry entries[MAX_ENTRIES]; int num_entries, i; /* Parse parameters from stdin, building a table of entries */ for (num_entries = 0; !feof(stdin); num_entries++) { entries[num_entries].val = fmakeword(stdin, '&', &cl); plustospace(entries[num_entries].val); unescape_url(entries[num_entries].val); entries[num_entries].name = makeword(entries[num_entries].val, '='); } /* Spit out the HTML boilerplate */ printf("Content-type: text/html\n"); printf("\n"); printf(""); printf(""); printf("Named Parameter Echo\n"); printf(""); printf(""); printf("You entered the following parameters:\n"); printf("
    \n"); /* Echo the parameters back to the user */ for(i = 0; i < num_entries; i++) printf("
  • %s = %s\n", entries[i].name, entries[i].val); /* And close out with more boilerplate */ printf("
\n"); printf("\n"); printf("\n"); } ================= Page 391 ================= Frames Layout Sorry, this document can be viewed only with a frames-capable browser. <a href = "frame1.html">Take this link</a> to the first HTML document in the set. ================= Page 410 ================= Table of Contents

Table of Contents

================= Page 452 ================= Kumquat Market Prices

Kumquat Market Prices

Kumquats are currently trading at $1.96 per pound. ================= Page 458 ================= #!/bin/sh # # Let the client know we are sending a multipart document # with a boundary string of "NEXT" # echo "HTTP/1.0 200" echo "Content-type: multipart/x-mixed-replace;boundary=NEXT" echo "" echo "--NEXT" while true do # # Send the next part, followed by a boundary string # Then sleep five seconds before repeating # echo "Content-type: text/html" echo "" echo "" echo "" echo "Processes On This Server" echo "" echo "" echo "

Processes On This Server

" echo "Date:" date echo "

" echo "

"
ps -el
echo "
" echo "" echo "" echo "--NEXT" sleep 5 done ================= Page 511 ================= Every document must have a title ...your content goes here... ================= Page 523 ================= Required; replace this title with your own

Reiterate the title here

...Insert your document's contents here...
Include your name and contact information usually at the end of the document
================= Page 523 ================= Every XHTML document needs a title

Reiterate the title here

...Insert your document's contents here...
Include your name and contact information usually at the end of the document
================= Page 536 ================= I need a window of my own Your browser apparently doesn't support JavaScript. Please hyperlink to our site manually.