I'm building a website using frames where I have a menu with links on a top frame. The a items in the menu need to adopt and maintain a certain background color when the user clicks on them.
Here's what I've tried with little result:
On <head>:
<script type="text/javascript">
<!--
function onLink(aLink){
document.link.style.background.color = white; //resets current active link
document.getElementById(aLink).style.background.color = red; //sets the red background color for specified link
}
-->
</script>
On body:
<a href="kana.html" id="kana" target="rightFrame" onclick="onLink();"> KANA </a> <a href="kanji.html" id="kanji" target="rightFrame" onclick="onLink();"> KANJI </a> <a href="words.html" id="words" target="rightFrame" onclick="onLink();"> WORDS </a> <a href="sentences" id="sentences" target="rightFrame" onclick="onLink();"> SENTENCES </a> <a href="grammar" id="grammar" target="rightFrame" onclick="onLink();"> GRAMMAR </a> <a href="resources.html" id="resources" target="rightFrame" onclick="onLink();"> RESOURCES </a>

New Topic/Question
Reply



MultiQuote





|