I have a menu that in case the user select the option it will changing, etc! The problem is that it leaves all other programs open when you access one.
Menu:
<body onLoad="AlternarAbas('td_usua','div_usua')">
<table width="945" height="50" align="left" valign="top" cellspacing="0" cellpadding="5" border="0" style="border-left: 1px solid #000000;" >
<tr>
<td height="20" width="50" class="menu" id="td_usua" onClick="AlternarAbas('td_usua','div_usua')">Usuario</td>
<td height="20" width="50" class="menu" id="td_empr" onClick="AlternarAbas('td_empr','div_empr')">Empresa</td>
<td height="20" width="50" class="menu" id="td_nota" onClick="AlternarAbas('td_nota','div_nota')">Nota Fiscal</td>
<td height="20" width="50" class="menu" id="td_soft" onClick="AlternarAbas('td_soft','div_soft')">Software</td>
</tr>
AlternateAbas:
function AlternarAbas(menu,conteudo)
{
for (i=0;i<arAbas.length;i++)
{
m = document.getElementById(arAbas[i].menu);
m.className = 'menu';
c = document.getElementById(arAbas[i].conteudo)
c.style.display = 'none';
}
m = document.getElementById(menu)
m.className = 'menu-sel';
c = document.getElementById(conteudo)
c.style.display = '';
}
arAbas:
var arAbas = new Array();
arAbas[0] = new stAba('td_usua','div_usua');
arAbas[1] = new stAba('td_empr','div_empr');
arAbas[2] = new stAba('td_nota','div_nota');
arAbas[3] = new stAba('td_soft','div_soft');
stAba:
function stAba(menu,conteudo)
{
this.menu = menu;
this.conteudo = conteudo;
}
So I thought I'd use switch
or (if..else)
to change the selection mode. That is, it will only open a certain area when it is accessed. But I have no idea how to implement .. Any suggestions or tips?
Even posting a response, I'd like to know at least whether a way to do it using switch
or (if..else)
!