What you have to remember is that many of the code examples shown are examples on ONLY that part of the code. The author is assuming that you'll understand that the example (below) is nested inside the basic shell that you learned in chapter 1.
Remember that when you see:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<form action="http://www.example.org/search.aspx" methog="get" name="frmSearch">
Search:
<input type="text" name="txtSearch" value="Search for" size="20"
maxlength="64" />
<input type="submit" value="Submit" />
</form>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
what they're saying is this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title></title>
</head>
<body>
<form action="http://www.example.org/search.aspx" methog="get" name="frmSearch">
Search:
<input type="text" name="txtSearch" value="Search for" size="20"
maxlength="64" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For the examples to show on a web page you need to include - at an absolute minimum - the following tags:
<html>
<head>
<title>
</title>
</head>
<body>
The code from the examples here.
</body>
</html>
Adding those should make the code show up as intended on the web page.
What I did was make a HTML starting template and when I start a new HTML page I start with the template that follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title></title>
</head>
<body>
</body>
</html>
Then I just put the curser between the <title> tags or the <body> tags to start writing.
Hope this helps if you're still around.
Last edited by edwait; December 6th, 2009 at 11:57 AM..
|