PDA

View Full Version : Image Swap problem in Table Cells


grifter2
01-03-2002, 09:00 AM
I have the following code in a file:

<html>

<head>

<script language="javascript1.1">
<!--

/*Code generated by the onMouseover whipper
Visit http://javascriptkit.com for more info*/

b813=new Image(150,25)
b813.src="Image5a.gif"
b874=new Image(150,25)
b874.src="Image5.gif"
b814=new Image(150,25)
b814.src="Image6a.gif"
b875=new Image(150,25)
b875.src="Image6.gif"

//-->
</script>

<script>
<!--
function filter(imagename,objectsrc){
if (document.images)
document.images[imagename].src=eval(objectsrc+".src")
}
//-->
</script>

</head>

<body>

<div align="left">
<table border="1" cellpadding="0" cellspacing="0" width="150" bordercolorlight="#000000" bordercolordark="#000000" bordercolor="#000000">
<tr>
<td>
<a href="yoururl.htm" onmouseover="filter('b78','b874')" onmouseout="filter('b78','b813')">
<img src="Image5a.gif" name="b78" border="0" width="150" height="25"></a>
</td>
</tr>
<tr>
<td>
<a href="yoururl.htm" onmouseover="filter('b79','b875')" onmouseout="filter('b79','b814')">
<img src="Image6a.gif" name="b79" border="0" width="150" height="25"></a>
</td>
</tr>
</table>
</div>
</body>

</html>

The rollover effects work just fine. But, there's a white space at the bottom of each cell that I can't seem to get rid of. Cellspacing and cellpadding are set at "0". Border is set a "black" "1". Width and height are specified in both the <table> tag and the <img> tag.

I just don't know what the hell's going on. Maybe someone out there has had the same problem?

mighty_muke
01-03-2002, 02:27 PM
Try putting the </td> straight after the </a> like:
</a></td>

The newline character seems to add the whitespace under the image when I try it.
MM.

grifter2
01-03-2002, 02:58 PM
That did the job. Thanks.:D