I'm making a template and I need to put the active page in different color from the other buttons. For this I need to get the contents of one and compare it with the page link.
If it is the same I put a new class on the button where it will pull the css from the active menu.
<script type="text/javascript">
function mostrarAtivo(tag){
var tag_li = document.getElementById('lista_menu');
var tag_a = tag_li.getElementsByTagName('a');
for (i=0; i<tag_a.length; i++ )
{
/* pegar o link da tag a e compara com o link da página, se for igual o link é o link ativo
(recebe uma classe chamada "active"). */
}
}
</script>
Well, you do not need to put the whole script, I just want to know how to get the link inside a tag:
<a href="">
I searched the internet but could not find it, now if you want to put the whole script would be better. But you just have to explain how to get the link to get the link from the rest of the file I know how to do and after I do I post the complete answer here.