Hi Brett,

The problem isn't this:

> var whatever = document.getElementById(layer);

I's this:

> onhover="namedFunction('timer')

What you're doing is mixing JavaScript in the HTML of the page. What you should 
do is use a "listener" on your link to see when it is hovered over. This code 
uses the prototype library [1] but you can do the same thing with other 
libraries such as jQuery and mootools. I recommend you take a look at one of 
those libraries to help you with this stuff. (Warning: I've not tested this 
code!)

In the <head> of your page:

<script type="text/javascript">

// listen for the page being loaded completely
Event.observe(window, 'load', HoverListener, false);

function HoverListener()
{
        // for each link with the class 'hover'
        $$('a.hover').each(function(element)
        {
                // listen for the 'mouseover' event on this link and execute 
the 'RunCode' function when it happens
                Event.observe(element, 'mouseover', RunCode, false);
                // also listen for the 'focus' event on this link for 
keyboard-compatibility
                Event.observe(element, 'focus', RunCode, false);
        });
}

function RunCode(e)
{
        // get the element which triggered the event
        var el = Event.findElement(e, 'A');

        // now do your code! In this example I'm just alert()ing the text in 
the link
        alert(el.innerHTML);
}

</script>

You can apply the class "hover" to any link, it will execute the RunCode 
function above when that link is hovered over (or receives focus from a 
keyboard action):

<a href="somepage.html" class="hover">Hover over this link...</a>

Hope this helps,

Chris

[1] http://prototypejs.org


This message has been scanned for malware by SurfControl plc. 
www.surfcontrol.com


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to