Hypertext Markup Language

Internet development over the last few years has moved from static content to dynamic content. Just a short time ago, creating state-of-the-art Web pages required little more than mastery of Hypertext Markup Language, or HTML. HTML is a simple, text-based language that uses a series of tags to create a document that can be viewed by a browser. The HTML code in Listing 1-1, for example, renders the simple Web page shown in Figure 1-1 on the following page.

Listing 1-1. HTML code for a simple Web page.


<HTML> <HEAD> <TITLE>My First Web Page</TITLE> </HEAD> <BODY BGCOLOR="WHITE"> <H2><CENTER>Welcome to My First Web Page!</CENTER></H2> </BODY> </HTML> 

Figure 1-1. A simple Web page.

HTML is not really a language in the same sense as C++ or Microsoft Visual Basic; it's more like a formatting syntax for documents that use escape codes. In fact, we often liken HTML coding to creating a Microsoft Word document by typing formatting codes directly into Notepad. You can expect very little functionality.

HTML is a poor language from a programming perspective for a variety of reasons. First, consider the hyperlink, those underlined blue words that you click to go to another page. The hyperlink is essentially a glorified GOTO statement that provides a hard-coded jump to some location in the application. Reams of articles have been written about the GOTO statement and its evils. Hard-coded links, you see, create unmaintainable code, and if you've written HTML code for any period of time, you already know how hard it is to revise or reuse.

Second, HTML provides no real way to persist data throughout an application. In fact, it's difficult to even define an application on the Web. Each page represents a stateless transaction with the server, so how do you determine when an application begins and ends? Compare this with a typical client/server application, where the beginning is signaled by double-clicking an icon and the ending is determined by selecting Exit from the File menu.

Third, HTML allows limited interactivity. Standard HTML yields static Web pages with text, images, and hyperlinks to other pages. You might hear these sites referred to as the World Wide Yellow Pages because their format is pretty much the same as that of a phone book.

Admittedly, HTML can provide some interactivity through the use of intrinsic controls, the input devices you generally see in HTML forms. Simple data forms can be generated with tags such as <INPUT>. The <INPUT> tag allows creation of text boxes and check boxes as well as radio buttons and push buttons. Listing 1-2 creates an HTML form that displays text boxes for a name, a telephone number, and an e-mail address, as shown in Figure 1-2.

Listing 1-2. Code for an HTML form.


<HTML> <HEAD> <TITLE>Simple HTML Form</TITLE> </HEAD> <BODY BGCOLOR="WHITE"> <FORM> <INPUT TYPE="TEXT" NAME="txtName">Name<P> <INPUT TYPE="TEXT" NAME="txtPhone">Phone<P> <INPUT TYPE="TEXT" NAME="txtEMail">E-Mail<P> </FORM> </BODY> </HTML> 

Figure 1-2. A simple HTML form.

Forms represent the primary means of interaction in HTML. A user fills out a series of forms, which are then submitted to the back-end server. This submission process arranges the data from an HTML form in a predefined format and sends it as text to an executable file on the server. The server process can then manipulate the submitted data for the purpose of accessing a database, sending mail, or performing some other function.

HTML is created in plain text, so originally most HTML developers wrote their code directly in a text editor such as Notepad. As time went on, companies produced graphical development tools such as Microsoft FrontPage, which were designed to allow Web page creation without explicit knowledge of HTML. These graphical editors allow direct manipulation of the Web page with no laborious tag writing effort. Unfortunately, the strength of graphical editors is also their biggest drawback: they give developers the impression that they don't have to learn HTML syntax and tags—and nothing could be further from the truth. If you take one thing away from this introduction to HTML, remember this: you must know HTML to be a successful Web developer. Editing a page directly in text is a skill that will allow you to create exactly the effect you want whether or not it is directly supported by your favorite graphical editor. HTML is still the foundation of Internet development and will not be fully replaced anytime soon. In fact, attempts to enhance Web page development have made a thorough knowledge of HTML even more critical.



Programming Active Server Pages
Programming Active Server Pages (Microsoft Programming Series)
ISBN: 1572317000
EAN: 2147483647
Year: 1996
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net