S7even
06-12-2003, 08:17 AM
Can you tell me why the following works in IE, Mozilla and Opera but not in NS? I don't care about NS4, I just need it to work in NS6+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mouse Over</title>
<script language="JavaScript" type="text/javascript">
function domouseover(e) {
e = (e) ? e : (window.event) ? window.event : ""
if (e) {
var elem = (e.target) ? e.target : e.srcElement
if (elem.className == "test" ) {
y=elem.id+'r';
document.getElementById(y).style.color = 'red';
}
}
}
function domouseout(e) {
e = (e) ? e : (window.event) ? window.event : ""
if (e) {
var elem = (e.target) ? e.target : e.srcElement
if (elem.className == "test" ) {
y=elem.id+'r';
document.getElementById(y).style.color = 'black';
}
}
}
document.onmouseover=domouseover;
document.onmouseout=domouseout;
</script>
</head>
<body>
<div id="x1r">
This should become red when you mouse over the link, but it doesn't in Netscape.
</div>
<a href="#" id="x1" class="test">Mouse over me</a>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mouse Over</title>
<script language="JavaScript" type="text/javascript">
function domouseover(e) {
e = (e) ? e : (window.event) ? window.event : ""
if (e) {
var elem = (e.target) ? e.target : e.srcElement
if (elem.className == "test" ) {
y=elem.id+'r';
document.getElementById(y).style.color = 'red';
}
}
}
function domouseout(e) {
e = (e) ? e : (window.event) ? window.event : ""
if (e) {
var elem = (e.target) ? e.target : e.srcElement
if (elem.className == "test" ) {
y=elem.id+'r';
document.getElementById(y).style.color = 'black';
}
}
}
document.onmouseover=domouseover;
document.onmouseout=domouseout;
</script>
</head>
<body>
<div id="x1r">
This should become red when you mouse over the link, but it doesn't in Netscape.
</div>
<a href="#" id="x1" class="test">Mouse over me</a>
</body>
</html>