I have a table with a bunch of cells. (By no means! Amazing !: P) Some cells have a small div that, when you hover over the mouse, gets larger so that you can read the whole text. It works well and that’s it. However, since the html elements that appear later in the document have a higher z index, when the div grows, it is under other divs in other cells.
Some html codes:
<table>
<tr>
<td>
limited info
<div style="position: relative;">
<div style="position: absolute; top: 0; left: 0; width: 1em; height: 1em;" onmouseover="tooltipshow(this)" onmouseout="tooltiphide(this)">
informative long text is here
</div>
</div>
</td>
<td>
some short info
<div style="position: relative;">
<div style="position: absolute; top: 0; left: 0; width: 1em; height: 1em;" onmouseover="tooltipshow(this)" onmouseout="tooltiphide(this)">
longer explanation about what is really going on that covers the div up there ^^^. darn!
</div>
</div>
</td>
</tr>
</table>
Some js codes:
function tooltipshow(obj)
{
obj.style.width = '30em';
obj.style.zIndex = '100';
}
function tooltiphide(obj)
{
obj.style.width = '1em';
obj.style.zIndex = '20';
}
It doesn't matter if I dynamically set the z-index to something higher on mouseover. It does not affect like a z-index. I think this has something to do with the table.
I tested this in FireFox3. When I feel especially macho, I will check it in IE.