JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.
TRUSTED BY
Example:
<!-- STYLE -->
.tabs .current {
background-color: blue;
}
<!-- Your tabs -->
<div class="tabs">
<a href="test.html">Test.html
<a href="test2.html">Test2.ht
</div>
<script type="text/javascript">
function highlight_tab() {
var links = document.getElementsByTagN
for (i = 0; i < links.length; i++) {
var href = links[i].href;
if (window.location.href.matc
links[i].className += " current";
}
}
}
window.onload = highlight_tab;
</script>
How it works:
It goes through all the links on the page. Checks their href attribute against current location and if location contains it, applies "current" class to the matching link.
That's basic version of the script, it will not work with relative urls, and probably contains some bugs that will cause hightlighting wrong <a> elements, or maybe highlighting more than one.