Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Daniel T Filho

Expandir com getElementById

Recommended Posts

Bom dia!

 

gente, não sei mexer com JScript, porém pesquisando achei esse comando, mais não consigo fazer funcionar como preciso, alguém pode me ajudar?

 

abaixo como fiz. deve ter muita coisa errada.

 

<script>
function expand(xxx){
if(document.getElementById(xxx).style.display== "none"){
document.getElementById(xxx).style.display = "block";
}
else {
document.getElementById(xxx).style.display = "none"
}
}
</script>

 

 

<table width="100%" height="121" border="0" class="style10">
<tr>
<td height="117" align="left"><table width="100%" border="0">
<tr class="txtpreto">
<td width="14%" align="left" bgcolor="#CCCCCC"><strong>Produto</strong></td>
<td width="18%" align="left" bgcolor="#CCCCCC"><strong>Descrição</strong></td>
<td width="8%" align="center" bgcolor="#CCCCCC"><strong>Revisão</strong></td>
<td width="8%" align="center" bgcolor="#CCCCCC"><strong>Data Revisão</strong></td>
<td width="8%" align="center" bgcolor="#CCCCCC"><strong>Valor Total</strong></td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">%ant.prod%</td>
<td width="18%" class="txtpreto">%ant.desc%</td>
<td width="8%" align="center" class="txtpreto">%ant.revis%</td>
<td width="8%" align="center" class="txtpreto">%ant.data%</td>
<td width="8%" align="center" class="txtpreto">%ant.valor%</td>
</tr>
</table>

<a href='#link1' onclick='expand("1");'
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1F010010001001</td>
<td width="18%" class="txtpreto">SELADORA CONCENTRADA PLUS </td>
<td width="8%" align="center" class="txtpreto">001</td>
<td width="8%" align="center" class="txtpreto">23/10/12</td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
</a> <a name="link1"></a><br>
<span id="1" style="display: none; ">
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C010020036000</td>
<td width="18%" class="txtpreto">GALAO 3.600 L SELADORA CONCEN</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C050020001000</td>
<td width="18%" class="txtpreto">ETIQUETA ADESIVA 20 X 76 MM 4 </td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C050020003000</td>
<td width="18%" class="txtpreto">ETIQUETA ADESIVA 30 X 100 MM 3</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C060010002000</td>
<td width="18%" class="txtpreto">FITA ADESIVA 48 MM X 1800 M RE</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C070020001000</td>
<td width="18%" class="txtpreto">CAIXA DE PAPELAO N. 1 BASE SOL</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1L010010001000</td>
<td width="18%" class="txtpreto">SELADORA CONCENTRADA PLUS </td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C010020036000</td>
<td width="18%" class="txtpreto">GALAO 3.600 L SELADORA CONCEN</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C050020001000</td>
<td width="18%" class="txtpreto">ETIQUETA ADESIVA 20 X 76 MM 4 </td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C050020003000</td>
<td width="18%" class="txtpreto">ETIQUETA ADESIVA 30 X 100 MM 3</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C060010002000</td>
<td width="18%" class="txtpreto">FITA ADESIVA 48 MM X 1800 M RE</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1C070020001000</td>
<td width="18%" class="txtpreto">CAIXA DE PAPELAO N. 1 BASE SOL</td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1L010010001000</td>
<td width="18%" class="txtpreto">SELADORA CONCENTRADA PLUS </td>
<td width="8%" align="center" class="txtpreto"></td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
</span>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1F010010001001</td>
<td width="18%" class="txtpreto">SELADORA CONCENTRADA PLUS </td>
<td width="8%" align="center" class="txtpreto">002</td>
<td width="8%" align="center" class="txtpreto">23/10/12</td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
<table width="100%" height="33" border="0">
<tr>
<td width="14%" bgcolor="#FFFFFF" class="txtcinza">1F010010001001</td>
<td width="18%" class="txtpreto">SELADORA CONCENTRADA PLUS </td>
<td width="8%" align="center" class="txtpreto">003</td>
<td width="8%" align="center" class="txtpreto">24/10/12</td>
<td width="8%" align="center" class="txtpreto">Indisponivel</td>
</tr>
</table>
</tr>
</table>

Compartilhar este post


Link para o post
Compartilhar em outros sites

IDs, e CLASSes no css não podem começar com números.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Wiliam obrigado pela resposta.

A minha duvida é porque no DreamWeaver esse codigo funciona na visualização, porém quand eu gero o arquivo html ele simplesmente não funciona. Não sei pra onde correr.

Compartilhar este post


Link para o post
Compartilhar em outros sites

esqueça o dreamweaver =)

 

corra para onde realmente importa. Nos IEs novos aperte F12, no Chrome ou Firefox aperte Ctrl + Shift + J, e então vc verá o console de erros.

 

é ele que vai te dizer o pq não funciona, apontando exatamente oque, onde ai vc corrige.

http://wbruno.com.br/javascript-puro/como-debugar-javascript-firefox-erros-comuns/

Compartilhar este post


Link para o post
Compartilhar em outros sites

Wiliam,

 

obrigado pela dica. Ta quase resolvido! so tenho mais um problema. Pra criar esse HTML eu uso o meu sistema que abre esse layout, e joga as informações dentro por tag´s. Porem ele me cria uma outra sessão dentro do FORM com todas as informações enviadas. Tem como eu desabilitar essa parte? Porque.. numa dessas tag´s eu mando algumas linhas em html, e ele duplica a informação. Não sei se consegue entender.

 

obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.