Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Website Design/Showcase (http://www.chiefdelphi.com/forums/forumdisplay.php?f=64)
-   -   DHTML Menu Editing (http://www.chiefdelphi.com/forums/showthread.php?t=21319)

robot180 05-08-2003 01:52

I keep trying to get the menu to work but it isn't changing colors when I hover over it. I will try to post the code for someone to check and let me know whats wrong...

This is on the page:

<!-- toc -->
<script language="JavaScript">
<!--
function hover(name,direction)
{
if (direction == "on") { name.bgColor = "#000080"; }
else { name.bgColor = "#bbbbbb"; }
}
function jump(url)
{
location.replace(url);
}
// -->
</script>
<span style="font-size: 20"><center>Articles</center></span>
<table border="0" width="100%"><tbody>
<tr><td class="toc" name="a" onMouseOver="hover('a','on');"
onMouseOut="hover('a','off');" onClick="jump('latest%20news/list.html');">latest news</td></tr>
</tbody></table>
<!-- /toc -->

and this is in the stylesheet:

td {font-size: 18}
.toc {background-color: #bbbbbb; text-transform: uppercase; text-align: center}

piotrm 05-08-2003 02:03

u are passing "a" to the hover function and you are trying to change "a"'s properties; the problem is that u are not referring to a's right; you would have to do a "lookup by name" of the thing you are passing to hover or even easier; pass "this" instead

Code:

hover(this,'on');
and

Code:

hover(this,'off');
(this is replacing your hover calls from the thing u pasted)

good luck...

robot180 05-08-2003 17:28

I keep trying it using "this", without the quotes, and it still isn't working.

New code:

<td class="toc" name="a" onMouseOver="hover(this,'on');"
onMouseOut="hover(this,'off');" onClick="jump('latest%20news/list.html');">latest news</td>

The onClick works fine so I'm not worried about that. It just won't change colors when I hover over it. There are no error messages though.

robot180 05-08-2003 17:34

AH HAH!!! I just found the problem. It wasn't changing because the "class" attribute was set for "toc" (table of contents) Once I took that part out, it started working.


All times are GMT -5. The time now is 16:19.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi