'easy' CSS/JavaScript effect but not working!

  Limariami 22:05 09 Mar 2005
Locked

Hi all

Please help.

I cannot see what I am doing wrong. I am trying to create a straightforward effect using JavaScript and CSS, whereby a menu option changes colour when the mouse hovers, then loads a new page when clicked.

BUT it does not work at all. It seems that the browser (opera 7.51) is not seeing the function. This is the message I get in teh browser JavaScript console.

Event thread: onmouseover
Error:
name: ReferenceError
message: Statement on line 1: Reference to undefined variable: No such variable 'focusTitle'
Backtrace:
In unknown script
focusTitle(2);
At unknown location
{event handler trampoline}

The relevant bits of my code are

function focusTitle(j)
{
var currEl = document.getElementById('Title' + j);
currEl.className = "nav2" ;
}


and

td height="100" width="150">
div id="Title1" class="nav1" onMouseOver="focusTitle(1)" onmouseout="defocusTitle(1)" onclick="loadPage(1)">111 /div>
div id="Title2" class="nav1" onMouseOver="focusTitle(2)" onmouseout="defocusTitle(2)" onclick="loadPage(2)">222 /div>
/td>

Any ideas appreciated. Thanks.

  Limariami 22:08 09 Mar 2005

PS for some strange reason, I cannot see the less-than signs in the message I have just posted

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Alienware 17 R4 2017 review

These brilliant Lego posters show just what children's imaginations are capable of

Mac power user tips and hidden tricks

Comment réinitialiser votre PC, ordinateur portable ou tablette Windows ?