Active Menu

Java Script

<script>
function selected(obj){
var lilist = document.getElementById(‘menu’);
var alist = lilist.getElementsByTagName(‘a’);
for (i=0; i<alist.length; i++ )
{
alist[i].className=””;
}
obj.className=”red”;
}
</script>

Style
<style>
.red {
color:red;
background:#F39;
width:150px;
}

HTML
<ul id=”menu”>
<li><a href=”#” onClick=”selected(this)”>Home</a></li>
<li><a href=”#”  onClick=”selected(this)”>About Us</a></li>
<li><a href=”#”  onClick=”selected(this)”>Our Products</a></li>
<li><a href=”#” onClick=”selected(this)”>Trade Offers</a></li>
<li><a href=”#”  onClick=”selected(this)”>Contact Us</a></li>
</ul>

Leave A Comment