Hi Robert,
I have read the article on:
http://www.javascriptkit.com/dhtmltutors/nsevents.shtml
http://webreference.com/js/column74/
and found it very helpfull. Many thanks for the URL.
Howerver, there is a problem with one of the examples in the tutorial:
This should work for all browsers I believe:
var layer=event.srcElement || event.currentTarget || event.target;
event.srcElement is for IE4+,
event.currentTarget is for Gecko-based browsers
event.target is for NS4
But it does not work for NS6+ on the mouseout event!! It works with the
onmouover but not onmouseout. This is strange isn't it??
Please, do you know what I have to add to this line
var layer=event.srcElement || event.currentTarget || event.target;
so that it works for NS6+ as well??
Cheers,
Claudio
<html>
<head>
<script language="Javascript">
function bgChange(bgc)
{
if (!window.event)
{
event=arguments.callee.caller.arguments[0];
}
var layer=event.srcElement || event.currentTarget || event.target;
if (layer.style)
{
layer.style.backgroundColor=bgc;
}
else
{
layer.bgColor=bgc;
}
}
</script>
</head>
<body>
<ilayer>
<layer onmouseover="bgChange('green')" onmouseout="bgChange
('white')">
<span onmouseover="bgChange('green')" onmouseout="bgChange
('white')">BG Color Change</span>
</layer>
</ilayer>
</body>
</html>