tom-mt
09-21-2002, 07:46 PM
hi all,
i dont know why this DOM-javascript piece of code is not working in IE6 and Opera6; it's working fine in NS6.2 and Moz1.1; can someone help?
<html>
<head>
<title> manipulating with the DOM </title>
<style type="text/css">
body {
font-family: verdana;
font-size: 12px;
background-color: #ccc
}
#logo {
border: 1px solid #000
}
</style>
<script language="javascript">
function imageSwap()
{
var up = "img1.jpg";
var over = "img2.jpg";
var imageObj = document.getElementById("logo");
var imageSrc = imageObj.getAttribute("src");
if (imageSrc == up)
{
imageObj.setAttribute("src", over );
}
else
{
imageObj.setAttribute("src", up );
}
}
</script>
</head>
<body>
<a href="" onmouseover="imageSwap()"
onmouseout="imageSwap()">
<img id="logo" src="img1.jpg" />
</a>
</body>
</html>
i dont know why this DOM-javascript piece of code is not working in IE6 and Opera6; it's working fine in NS6.2 and Moz1.1; can someone help?
<html>
<head>
<title> manipulating with the DOM </title>
<style type="text/css">
body {
font-family: verdana;
font-size: 12px;
background-color: #ccc
}
#logo {
border: 1px solid #000
}
</style>
<script language="javascript">
function imageSwap()
{
var up = "img1.jpg";
var over = "img2.jpg";
var imageObj = document.getElementById("logo");
var imageSrc = imageObj.getAttribute("src");
if (imageSrc == up)
{
imageObj.setAttribute("src", over );
}
else
{
imageObj.setAttribute("src", up );
}
}
</script>
</head>
<body>
<a href="" onmouseover="imageSwap()"
onmouseout="imageSwap()">
<img id="logo" src="img1.jpg" />
</a>
</body>
</html>