The JS implementation changes the background when clicking the a TAB



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type=text/javascript src="alabel.js"></script>
<style type="text/css">
.curr{background:blue;display:inline;}
</style>

</head>
<body>
<div class="clMenu">
<span><a href="#">1</a></span>
</div>

</body>
</html>

In alabel. In js:


window.onload = function ()
{
var aspan = document.getElementsByTagName("span");
var i = 0;
for (i = 0; i < aspan.length; i++)
{
aspan[i].onclick = function ()
{
for (i = 0; i < aspan.length; i++) aspan[i].className = "";
this.className = "curr";
};
}
};

This allows you to add a red background to the a TAB when you click on it.

Note: display cannot be a block in the curr property, otherwise the background added is a whole line.