VK said:
RobG said:
Probably worth noting that CSS 2 (which became a recommendation in 1998)
allows the 'hover' pseudo-class on any element, so when enough browsers
support it (i.e. when IE finally supports it) you can do this without
any script at all:
p:hover {background-color: #ff0;}
[...]
That would be nice but Microsoft already gave its final answer on it.
"You have to use our behaviors or go to hell".
So the answer on "When IE will support anyElement:hover?" is: "Never".
Is there any official statement from Microsoft that backs this up?
Especially since we will be facing (or have you already tested the
beta of it?) IE 7.
Good news is that it is rather easy to combine a highlight behavior for
IE with the standard hover property, so you wouldn't need any
client-side scripting at all:
<html>
<head>
<title>Highlight Combo</title>
So you are omitting the start tag for the `head' element. Allowed in HTML,
but since we know there is hardly one fully standards compliant markup
parser in _browsers_ out there, probably error-prone.
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
body {background-color: #FFFFFF}
p {
font: 10pt Verdana, Geneva, sans-serif;
`pt' is a unit of length suited for printouts, not for the screen, as can be
seen as bad example on Microsoft's Web site (watch the left menu pane with
different display and font resolutions on different platforms). Use `em'
or `%' instead, IE should do fine with this and should even allow zooming
of fonts. Takes a bit of recalculation on your part, though ;-)
cursor: hand; cursor: pointer;
^^^^
This is invalid CSS.
}
p {
behavior: url(hilite.htc)
^^^^^^^^
And this is, too. However, there is no need for neither (and certainly
not for two selectors for the same element type, but that is for another
discussion in another newsgroup): as the `behavior' property is also
available as property of DOM objects in this particular UA, it is possible
and prudent to assign the property value via scripting. Say, for example,
the `p' element we are talking about has the ID `foo', that can be
accomplished with
....
<head>
...
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function behave()
{
var t;
if (document.getElementById
&& ((t = typeof document.getElementById) == "function"
|| t == "object"))
{
var o;
if ((o = document.getElementById('foo'))
&& typeof o.style != "undefined"
&& typeof o.style.behavior != "undefined")
{
o.style.behavior = "url(hilite.htc)";
}
}
}
</script>
</head>
<body ... onload="behave()">
...
<p id="foo">...</p>
...
</body>
....
PointedEars