Forum Moderators: open
I know this can be done by calling onmouseover/out from the TD tag but I have to get it working from a link (there will be multiple links each with a different rollover image in the TD).
The sample webpage:
[cuberis.com ]
Code:
<html>
<head>
<title>Change Test</title>
<style type="text/css">
td.image {
background: url(intside1.jpg);
}
td.image2 {
background: url(intside2.jpg);
}
</style>
</head> <body>
<table width="100" height="100">
<tr>
<td id="changebg" name="changebg">
<a href="#" onmouseover="changebg.className='image2'" onmouseout="changebg.className='image'">Change</a>
</td>
</tr>
</table>
</body>
</html>
Thanks!
and a warm welcome to these forums ;)
Try using document.getElementById like this...
<html>
<head>
<title>Change Test</title>
<style type="text/css">
td.image {
background: url(intside1.jpg);
}
td.image2 {
background: url(intside2.jpg);
}
</style>
</head>
<body>
<table width="100" height="100">
<tr>
<td id="changebg" class="image">
<a href="#" onmouseover="document.getElementById('changebg').className='image2'" onmouseout="document.getElementById('changebg').className='image'">Change</a>
</td>
</tr>
</table>
</body>
</html>
birdbrain