Java Reference
In-Depth Information
The following is a list of the main differences between XHTML and HTML:
XHTML recommends an XML declaration to be placed at the top of the fi le in the following form:
<?xml version='1.0'?>.
You also have to provide a DTD declaration at the top of the fi le, referencing the version of the
DTD standard you are using.
You have to include a reference to the XML namespace within the HTML element.
You need to supply all XHTML element names in lowercase, because XML is case-sensitive.
The
<head/> and <body/> elements must always be included in an XHTML document.
Tags must always be closed and nested correctly. When only one tag is required, such as with
line breaks, the tag is closed with a slash (for example, <br/> ).
Attribute values must always be denoted by quotation marks.
This set of rules makes it possible to keep a strict hierarchical structure to the elements, which in
turn makes it possible for the Document Object Model to work correctly. This also makes it possible
to standardize markup languages across all device types, so that the next version of WML (the markup
language of mobile devices) will also be compliant with the XHTML standard. You should now be cre-
ating your HTML documents according to the previously specifi ed rules. If you do so, you will fi nd it
much, much easier to write JavaScript that manipulates the page via the DOM and works in the way it
was intended.
ECMAScript
JavaScript itself followed a trajectory similar to that of HTML. It was fi rst used in Netscape Navigator
and then added to Internet Explorer. The Internet Explorer version of JavaScript was christened Jscript and
wasn't far removed from the version of JavaScript found in Netscape Navigator. However, once again,
there were differences between the two implementations and a lot of care had to be taken in writing script
for both browsers.
Oddly enough, it was left to the European Computer Manufacturers Association (ECMA) to propose a
standard specifi cation for JavaScript. This didn't appear until a few versions of JavaScript had already
been released. Unlike HTML, which had been developed from the start with the W3C consortium,
JavaScript was a proprietary creation. This is the reason that it is governed by a different standards body.
Microsoft and Netscape both agreed to use ECMA as the standards vehicle/debating forum, because of
its reputation for fast-tracking standards and perhaps also because of its perceived neutrality. The name
ECMAScript was chosen so as not to be biased toward either vendor's creation and also because the
“Java” part of JavaScript was a trademark of Sun licensed to Netscape. The standard, named ECMA-262,
laid down a specifi cation that was roughly equivalent to the JavaScript 1.1 specifi cation.
That said, the ECMAScript standard covers only core JavaScript features, such as the primitive data types
of numbers, strings, and Booleans, native objects like the Date, Array, and Math objects, and the procedural
statements like for and while loops, and if and else conditionals. It makes no reference to client-side
objects or collections, such as window, document, forms, links, and images. So, although the standard
helps to make core programming tasks compatible when both JavaScript and JScript comply with it, it is
Search WWH ::




Custom Search