By Stephen Bucaro
HTML (Hypertext Markup Language) is codes or tags that define the layout or structure of a webpage.
You might be interested to know that all documents (except those written in basic ASCII or unicode)
use some type of codes or tags to define the structure of a document. For example Microsoft
Word uses RTF (Rich Text Format) codes to layout of a Word document.
The first HTML was used in 1989 by the physicist Tim Berners-Lee working at the
CERN particle physics laboratory in Geneva Switzerland. It was used to share documents.
HTML was derived from a formatting language called SGML (Standard Generalized Markup
Language) which was created by the IETF (Internet Engineering Task Force) in the 1960s.
Let's study the HTML code for a very basic webpage, as shown below.
Note that the HTML tags are defined by a < (less-than) character and a > (greater-than)
character. The name of the tag, which defines its function, is contained within these characters.
Modern HTML (which is called XHTML) requires that every tag be followed by a "closing tag". A closing
tag is similar to an "opening tag" except it has a ⁄ (slash) character immediately after its
beginning less-than tag, in other words <⁄.
Returning to the HTML code for a very basic webpage, shown above, note that the first line is
the <html> tag. This tag defines the beginning of the webpage. Note that the last line is the
closing </html> tag. everything between the <html> and the </html> is the webpage.
Just below the opening HTML tag are the opening and closing head tags. Just below
the closing head tag is the opening body tag. Most every webpage has two parts,
a head section, and a body section. Although the code for the visible elements
of a webpage go between the opening and closing body tags, the head
you can't get there without at least a basic understanding of HTML.
document.getElementsByTagName("P").innerHTML = "Goodby World";
<p onclick="changeText()">Hello World</p>
Lets study the example above. Note that within the body section of the example is
the code <p>Hello World</p>. This is an opening paragraph tag, the text of the
paragraph "Hello World", and the closing paragraph tag. When we have an opening
tag and a closing tag that are the same, this defines an HTML element. Most HTML elements
Note in the above code, in the <p> element's opening tag we have attached a function named
changeText to the onclick event, <p onclick="changeText()">. So that
when the user clicks on the text, the changeText function is executed.
Note that within the head section of the document, we put opening and closing script
changeText function. At this point, let's not worry about the details of the code within
the function. It suffices to say that this code replaces the text Hello World in the paragraph
element with the text "Goodby World".
When the webpage loads, the head section is parsed first, allocating the changeText
function. Then the body section is parsed and displayed. If the user clicks within the paragraph,
the paragraph element's onclick event will trigger, which will execute the changeText
function, which will change the paragraph element's contents from "Hello World" to "Goodby World".
If you have even just an inkling of what I explained here, you are on your way to becoming a
functions to make things happen on the webpage. It's that simple.
More Java Script Code:
• Using the Java Script Array Object
• Easy Expanding Banner Code
• Replace Drop-down with Drag-and-drop
• How Far Did the User Scroll?
• Submit Forms Without CGI
• Calculators for Your Web Site : Loan Payment Calculator
• Allowing Multiple Selections from Drop-down Select List
• Easy Picture Panning Code