3
I have a menu of tabs that as you select the tabs changes the content.
Flaps change:
<script language="JavaScript">
function stAba(menu,conteudo)
{
this.menu = menu;
this.conteudo = conteudo;
}
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');
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 = '';
}
</script>
My question is: "How to clear data from previous tab when selecting another tab?"
Menu image:
I call the AlternarAbas()
in the menu where the desired option is chosen:
<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>
The data to which I refer are the ones that the user types. That is, if the user type something in the area of incluir do Usuário
and then change to Empresa
, the data he reported on incluir
will disappear!
image of include:
Works if called by an iframe?
<tr>
<td height="300" width="" class="tb-conteudo" colspan="4" align="left" valign="top" >
<div id="div_usua" class="conteudo" style="display: none; padding-top:5px;">
<table align="left" border="0" width="2%">
<tr>
<td>
<iframe style="border-radius:20px;" scrolling="no" src="../sai_cada_usua/menu_com_abas_usua.php" width="900" height="400 " >
</iframe>
</td>
</tr>
</table>
</div>
</td>
</tr>
Thanks for the help @Zuul was exactly why I was looking for! Even not working on my code, I decode it to implement. But that’s the idea I wanted ^^
– Felipe