Вы находитесь на странице: 1из 2

angel, either, especially when comparing the results of stylesheet assignments as rendered in the

Windows
and Macintosh versions of the browser (developed by two separate teams).
CSS Level 2 adds more style functionality to the standard, and IE6, Mozilla-based browsers, and Safari
support
a good deal of Level 2 (albeit unevenly) with the latest versions, such as Mozilla 1.8+ and Safari 2+
beginning support for CSS Level 3 features. Rendering of styled content is more harmonious among
browsers, largely thanks to guidelines about how styles should render. Complex layouts, however, still
need
careful tweaking from time to time because of different interpretations of the standard.
JavaScript plays a role in stylesheets in IE4+, Mozilla, and Safari because those browsers object
models permit
dynamic modification to styles associated with any content on the page. Stylesheet information is part
of the object model and therefore is accessible and modifiable from JavaScript.

Dynamic HTML and positioning

Perhaps the biggest improvements to the inner workings of the Level 4 browsers from both Netscape
and
Microsoft revolved around a concept called Dynamic HTML (DHTML). The ultimate goal of DHTML was
to
enable scripts in documents to control the content, content position, and content appearance in
response to
user actions. To that end, the W3C organization developed another standard for the precise positioning
of
HTML elements on a page as an extension of the CSS standards effort. The CSS-Positioning
recommendation
was later blended into the CSS standard, and both are now part of CSS Level 2. With positioning, you
can define an exact location on the page where an element should appear, whether the item should be
visible,
and what stacking order it should take among all the items that might overlap it.
IE4+ adheres to the positioning-standard syntax and makes positionable items subject to script
control.
Navigator 4 followed the standard from a conceptual point of view, but it implemented an alternative
methodology involving an entirely new, and eventually unsanctioned, tag for layers. Such positionable
items
were scriptable in Navigator 4 as well, although a lot of the script syntax differed from that used in
Internet
Explorer 4. Fortunately for DHTML authors, Mozilla, through its adherence to the CSS standard, is more
syntactically in line with DHTML style properties employed in IE4+.
Of more interest these days is the ability to modify the inline content of a Web page without reloading
the
entire page. Fundamental standards from the W3C DOM Level 1 are supported by a wide range of
browsers, including IE5+, Mozilla, Safari, and Opera. You can accomplish quite a lot using the same
basic
syntax across all of these browsers. Some challenges remain, however, as youll see throughout this
book.

Developing a Scripting Strategy

Browsers representing the latest generation contain a hodgepodge of standards and proprietary
extensions.
Even if you try to script to a common denominator among todays browsers, your code probably wont
take
into account the earlier versions of both the JavaScript core language and the browser DOMs.
The true challenge for authors is determining the audience for which scripted pages are intended. Each
new
browser generation not only brings with it new and exciting features you are probably eager to employ
in
your pages, but also adds to the fragmentation of the audience visiting a publicly accessible page.
With each
new browser upgrade, fewer existing users are willing to download megabytes of browser merely to
have
the latest and greatest browser version. For many pioneersand certainly for most nontechie users

there is a shrinking imperative to upgrade browsers unless the new browser comes via a new
computer or
operating system upgrade.

14

Part I

Getting Started with JavaScript

Вам также может понравиться