HTML (English) 12 - සාමාන්‍යපෙළ තොරතුරු හා සන්නිවේදන තාක්ෂණය

HTML (English) 12

 

PREFORMATTED TEXT

Remember how the browser generally ignores white space (spaces, tabs, and returns) within the HTML document?  This is usually a good and helpful thing, but occasionally you'll want to control the layout of a document, or a part of a document, so that the various elements line up precisely.  The <PRE> </PRE> tag pair can be used for this purpose.  The tags are useful for preformatted text.  They cause the enclosed text to be displayed with a mono spaced font, that is, one in which each letter occupies the same amount of space.  Moreover, white space is displayed in the output just as it is placed in the input HTML file.  This makes it possible to establish columns and so on and have them appear in the browser window. As you can see if you type in the following listing, Jumbo is making one last attempt to get rid of that Luscious Licorice-Lime brew.  In Listing 1-13 you can see the preformatted HTML text.  Here's a revised listing of the menu page that uses the <PRE> tag, along with a figure that shows the result. 

Listing 1-13 Preformat.html

<HTML>

<!--          Listing 1-13 Jumbo's Pricing strategy                               -->

<HEAD>

<TITLE>Jumbo's  Jungle Java Joint - Primo Menu Page</TITLE>

</HEAD>

<BODY>

<H1>      The Place for Premium Java             <H1>

<HR>

<H2>      Today's Specials                                  </H2>

<OL>

<LI><B>bold</B> Brazilian Roast                 </LI>

<LI><I>Italian</I> Espresso                                            </LI>

<LI><U>Luscious</U> Licorice-Lime                            </LI>

</UL>

<LI>Great for the whole family!!!                   </LI>

<LI>Add a topping of whipped cream!!!        </LI>

<LI>Try it ice-cold or piping hot!!!   </LI>

</UL>

</OL>

<HR>

<H3>Today only pricing!!!</H3>

<PRE>

  1. Brazilian Roast                    1.25
  2. Italian Espresso                   1.75
  3. Licorice-Lime                                       .25

</PRE>

<A HREF="Logo.html" Go back to Jumbo's home page            </A>

</BODY>

</HTML>

 

  

 

The Form Element

The FORM element is a powerful part of HTML, allowing users to actively interact with your website. Here is a list of all the different ways HTML forms can be used, and how to create them yourself.

You can use all sorts of neat things in a HTML form: checkboxes, radio boxes, text input windows, buttons, etc. Unfortunately, a HTML form doesn't process the data. It sends it to a cgi program on the server to be processed. So if you want to use forms in your web site, you're going to need a CGI program to process the data.

The form element takes three attributes: ACTION, METHOD and ENCTYPE.

For example:

<FORM ACTION="http://www.vive.com/some_directory/cgi-bin/cgi_program"> ... input items ...

ACTION specifies the URL where the form content is to be sent. Usually this is a cgi_program that process the data, although you can use a mailto URL. In this case, the FORM content is mailed to the indicated address. METHOD gives the method for sending information to the URL. The default is GET.

Following the FORM element are all the various input items. Each element will send to the CGI program two bits of data: a variable name NAME and the actual data received from  the user VALUE. NAME is specified in the HTML code.

For example, NAME could be "email address" and the corresponding value inputed by the user is "htmltutorpro@usa.net". Here are the various types of input items: