You appear to have acquired a number of misconceptions and false
terminology, which hinder understanding.
I have seen sites using css attribute like "hover" to make dynamic
websites.
Those are pseudo-classes, not attributes:
In some sites most elements don't have direct event handlers like
'mouseover', 'mouseout' etc attached to html elements. Instead they
use CSS. Could any one you give me some idea about invoking
JavaScript event handlers via css for CSS attributes like "hover"?
`mouseover', `mouseout' etc. are _not_ "event handlers", those are event
types. There is also no such thing as "JavaScript event handlers". And
even if there were, you could not "invoke" them "via css"; CSS is merely
a formatting language.
<
http://www.w3.org/Style/CSS/>
When the user or a program does something in a user agent, an event
occurs. That may create an event object to propagate the event in the
document tree.
<
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow>
<
http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.htm...>
It may also, rather independently of the DOM, trigger a style sheet selector
that uses a dynamic pseudo-class.
DOM implementations provide internal event-handlers so that code may
handle these events. Event-handlers call one or more event-listeners; the
latter can be added with implementations that implement specified interfaces.
<
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener>
<
http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.htm...>
HTML elements provide event-handler attributes which value is supposed tobe
code written in a scripting language that is executed when the event occurs.
<
http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3>
(Here event-handler attributes are called "events"; watch the date of this
Specification and don't let yourself be confused by this.)
DOM objects may provide proprietary event-handler properties which value is
supposed to be (a reference to) a callable object that contains the code to
be executed on event. If such a DOM object represents an element in the
document, then that element does not need to have one of the aforementioned
event-handler attributes specified, provided there is an event-handler
property for that attribute.
There are also proprietary events and corresponding event-handler properties
that have no corresponding event-handler attribute in Valid markup, e.g.
<
https://developer.mozilla.org/en/DOM/element#Event_Handlers>
(Noticed that there has been no mentioning of JavaScript until here? For
these features are independent of a programming language.)
Now, DOM implementations also provide properties that implement interfaces
of CSS-related APIs:
<
http://www.w3.org/TR/DOM-Level-2-Style/css.html>
You can use these properties to manipulate style sheets, e.g.
element.style.display = "none";
to prevent an the element that is represented by the object `element' refers
to from being rendered.
However, you only need to do this for user agents that do not support the
corresponding CSS property, or pseudo-class for the element in question, or
CSS at all.
E.g: In hp.com, tabs like 'Support & Drivers' or 'Shop for Products'
are <a> HTML elements which don't have any event handlers directly
attached to them. Still they modify the DOM on mouseover/out.
If anything, they would modify the document tree; the DOM is a *model*, an
API instead, and usually not modified by an application using it. (In fact,
it is strongly recommended against trying to modify a DOM implementation on
the fly; the objects provided are *host* *objects*, not, e.g. ECMAScript
native objects.)
I believe they are done via CSS.
The content is styled with CSS, but I presume the content is exchanged with
the IXMLHTTPRequest API (XHR, also known as AJAX -- Asynchronous JavaScript
and XML).
<
https://developer.mozilla.org/en/AJAX>
Of course, this doesn't work where XHR support is unavailable, and it can
cause considerable delays if XHR support is available but there is small
bandwidth or the display device is a mobile one.
In fact, the whole HP website is not exactly a showcase of good Web
authoring. Starts with
<
http://validator.w3.org/check?verbose=1&uri=http://www.hp.com%2...>
| 105 Errors, 15 warnings
<
http://jigsaw.w3.org/css-validator/validator?profile=css3&warning=2&u...>
| Sorry! We found the following errors (6)
and ends with their using jQuery from which you should stay far away at
least at this point of its development. (Search the archives. JFTR:
I have very fast Internet access here, and a reasonably fast CPU, OS, and
browser[1]; yet switching from one section to the other through mouseover
takes about half a second! Talk about code efficiency ...)
Could any body of you please give me some guidance regarding this ?
[x] done
HTH
PointedEars
___________
[1] Cable Internet access, 15000 kbps downstream top;
Pentium M 740, 1 GB RAM;
Debian GNU/Linux lenny/testing/unstable/experimental,
Linux 2.6.28.8-20090322.180402, 1 GB Swap;
KDE 3.5.9.dfsg.1-6, Firefox/Iceweasel 3.0.6