Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1375 How can I highlight the background color of table cells using onMouseOver, when the table is nested within a layer?

You are here: irt.org | FAQ | DHTML | Q1375 [ previous next ]

Try:

<html>
<head>

<style><!--
.relative { position:relative; }
.absolute { position:absolute; }
//--></style>

<script language="JavaScript"><!--
var color = '';

function over(outer,id) {
    if (document.layers) {
        window.color = window.document.layers[outer].document.layers[id].bgColor;
        window.document.layers[outer].document.layers[id].bgColor = '#FF0000';
    }
    else if (document.all) {
        window.color = window.document.all[id].style.background;
        window.document.all[id].style.background = '#FF0000';
    }
}

function out(outer,id) {
    if (document.layers)
        window.document.layers[outer].document.layers[id].bgColor = window.color;
    else if (document.all)
        window.document.all[id].style.background = window.color;
}
//--></script>

</head>

<body>

<span id="outer" class="absolute">

<table>
<tr>
<td id="id1" class="relative"><a href="http://www.irt.org/" onMouseOver="window.over('outer','id1')" onMouseOut="window.out('outer','id1')">test</a></td>
<td id="id2" class="relative"><a href="http://www.irt.org/" onMouseOver="window.over('outer','id2')" onMouseOut="window.out('outer','id2')">test</a></td>
</tr>
</table>

</span>

</body>
</html>

Dietmar Rietsch writes:

I just tried this script with Netscape 4.7. With Netscape you have to define the table width with pixels not percentages.

Feedback on 'Q1375 How can I highlight the background color of table cells using onMouseOver, when the table is nested within a layer?'

©2018 Martin Webb