How can I highlight the corresponding titles of clicked links?

Posted by danielle on Stack Overflow See other posts from Stack Overflow or by danielle
Published on 2010-04-27T19:07:02Z Indexed on 2010/04/28 5:03 UTC
Read the original article Hit count: 336

Filed under:
|
|
|

I'm writing an XSL file that contains a side-nav menu with a list of links. When the user clicks on one of the links, the page jumps to the corresponding table of information for that link. How can I make it so that when the link is clicked, the title of that table (not the link itself) is highlighted? It should also un-highlight if another link is clicked.

Here is the menu of links:

<div onclick = "highlight(this);" onblur = "undoHighlight(this);">
<a href = "#{generate-id(.)}">
<xsl:value-of select = "."/> (<xsl:value-of select = "count(../n1:entry)"/>)
</a>
</div>

This is the javascript for the highlight/undoHighlight functions:

function highlight(link)
{
     undoHighlight(link)
     link.style.background = "red";
}
function undoHighlight(link)
{
     link.style.background = "white"; 
}

Any help would be appreciated. Thanks in advance!

© Stack Overflow or respective owner

Related posts about xslt

Related posts about JavaScript