Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Changing the Color of Selected item in menu using javascript

Apr 8, 2010
In header Section you should write the this script function


<script language="javascript">
var selectEl = null; // keep track of currently selected
function mo(el) {
    if (selectEl) { // unselect selected
        selectEl.style.backgroundColor = 'gray';
        selectEl.style.border = '0px inset black';
    }
    selectEl = el; // new selected
    el.style.backgroundColor = 'navy';
}
</script>

After Completion of writing the script function design the table or div with your elements
after that give call the JavaScript function for whatever the elements you need to select

On each link write this function like this 


<td>
<a href="index.html"onclick="mo(this)">Products</a>
</td>

I hope it helps you happy coding

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

2 comments :

Shameer said...

I hope this will me. i will check it tomorrow . Thank u

Anonymous said...

how to menu bar use.. Eg(File-->open click means open some file) how to use this in use coding and design..after how to write coding in radio button and dropdownlist..

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.