Thursday, 24 July 2008

The HTML Element Must Be the Root Element | Print |
 
The opening tag of any XHTML document must be:
<html>
and the last tag in the XHTML document must be:
</html>
The only things that may come before the opening <html> tag are the XML declaration and DOCTYPE
declaration because all XML documents must have one unique root element, which contains the rest of
the document. In the case of XHTML documents, it is the <html> element.
Tags Must Nest Properly
When you read that tags must nest properly, it is a bit like reading they must appear in a symmetrical
order. If you want to have one element inside another, then both its opening and closing tags must be
inside the containing element. For example, the following is allowed:
<p> This paragraph contains some <em>emphasized text.</em></p>
Whereas the following is wrong because the closing </em> tag is not inside the paragraph element:
<p> This paragraph contains some <em>emphasized text. </p></em>
In other words, if an element is to contain another element, it must wholly contain that element.
A Few Words About JavaScript
Having addressed the differences between writing HTML and XHTML pages, and having learned how
CSS can be used to style pages, a few words should be said about JavaScript. JavaScript is a type of
programming language known as a scripting language that when used in aWeb page allows you to control
many features of how the browser behaves. JavaScript is supported by both IE and Netscape (as well as
many other browsers that use the same core code as Netscape, such as Mozilla). You can embed
JavaScript into your HTML and XHTML documents to achieve all manner of tasks, from practical
applications such as performing calculations to visual effects such as creating rollover buttons that
change image or color as users move their mouse over them.
One of the greatest strengths of JavaScript is that code can be programmed to run when an event fires. An
event can be caused by something like a document loading or a window closing, or it can be caused by a
user interacting with the site—for example pressing a key, moving a mouse over a particular element, or
submitting a form. Indeed, you will see how XHTML features several event handler attributes (such as
onMouseOver and onClick) so that scripts can be triggered when a user interacts with an element.
JavaScript can be a very powerful language in the right hands, and many books have been written on the
subject. While there is not space to teach you JavaScript in great depth in this book, you can certainly get a
taste for what it can do, and after reading Chapter 14, which introduces the language, and Chapter 15,
which shows lots of example scripts, you should be able to incorporate JavaScripts into yourWeb
pages—and thousands of free JavaScripts are available on the Web that you can use, too.
This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 600

No comment posted

Search
Read This
VI-Editor Problems Opening Files

Great Linux -  When you invoke vi, the message [open mode] appears. Your terminal type is...
Read more....

Delete Files From The Recent File List In Windows

This tip requires a change to the Windows Registry. Please see the MSFN Guide "Backup Your...
Read more....

IP v6 Networking - DECnet Phase IV

IP v6  Networking - DECnet Phase IV Digital Equipment’s DECnet Phase IV uses addresses that...
Read more....

Dynamic Learning Dreamweaver CS3 Nov 2007 eBook

The type of the release is: eBook In the CHM format with ISBN: 0596510578 and Pub Date:...
Read more....

Last Post
Live Traffic
Statistic


Excess Article
Last Comment

Home | Css Generator | Exchange Links | Computer | Ebook | English Section | Indo Section | Tips | Website | Sitemap
© 2007-2008 Online Science www.g-excess.com

Page Loading Time: 0.000019 seconds.