Ir para conteúdo

POWERED BY:

Arquivado

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

renato9863

Codigo JS não funciona no Firefox

Recommended Posts

Olá a todos, alguém poderia me ajudar no código abaixo, pois não sei como fazer ele funcionar no Firefox:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Teste</title><script language="JavaScript">  function liga(obj){if(document.Form.txtCategoria[0].checked || document.Form.txtCategoria[1].checked){  document.all['cam'].innerHTML="<input name=gerar_boleto id=gerar_boleto type=checkbox value=sim>Marque a opção ao lado para gerar o boleto de pagamento da Anuidade.";}  else{  document.all['cam'].innerHTML=""}  }  </script>  </head><body><form name="Form" action="" method="post" onSubmit="return validar(this)"><table width=284 border=0 cellpadding="2" cellspacing="1" bgcolor="#666666">		<tr bgcolor="#CCCCCC">		  <td width=152><strong><FONT color=#000000>Categoria de 			Sócio</FONT></strong> </td>		  <td width=116><strong><FONT color=#000000>Anuidade R$</FONT></strong></td>	</tr>		<tr>		  <td width=152 bgcolor="#FFFFFF"><input type="radio" value="SP" name="txtCategoria" onClick="liga(this)">		  Sócio Profissional </td>		  <td width=116 bgcolor="#FFFFFF">20,00 </td>	</tr>		<tr>		  <td width=152 bgcolor="#FFFFFF"><input type="radio" value="SE" name="txtCategoria" onClick="liga(this)">		  Sócio Estudante </td>		  <td width=116 bgcolor="#FFFFFF">10,00</td>	</tr>		<tr>		  <td width=152 bgcolor="#FFFFFF"><input type="radio" value="NS" name="txtCategoria" onClick="liga(this)">		  Não Sócio</td>		  <td width=116 bgcolor="#FFFFFF">----</td>	</tr></table></p><br /><span id="cam"></span><br /><p><input name="acao" value="cadastrar" type="hidden"><input name="Enviar" type="button" value="enviar" /></p></form></body></html>

Quem puder dá uma ajuda ou outra alternativa agradeço...

 

Renato

Compartilhar este post


Link para o post
Compartilhar em outros sites

Amigo, troque

 

document.all['cam']

por

 

document.getElementById('cam')

Valeu!!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá benck, fiz o que você sugeriu... e não funcionou... e mais com o IE onde estava funcionando com document.getElementById('cam') ele para de funcionar tbm..Se tiver outra alternativa agradeço..ObrigadoRenato

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara, tem certeza que tu alterou corretamente? Fiz o teste aqui e funcionou legal

 

Vou mandar o código que alterei

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Teste</title><script language="JavaScript">  function liga(obj){if(document.Form.txtCategoria[0].checked || document.Form.txtCategoria[1].checked){  document.getElementById('cam').innerHTML="<input name=gerar_boleto id=gerar_boleto type=checkbox value=sim>Marque a opção ao lado para gerar o boleto de pagamento da Anuidade.";}  else{  document.getElementById('cam').innerHTML=""}  }  </script>  </head><body><form name="Form" action="" method="post" onSubmit="return validar(this)"><table width=284 border=0 cellpadding="2" cellspacing="1" bgcolor="#666666">		<tr bgcolor="#CCCCCC">		  <td width=152><strong><FONT color=#000000>Categoria de			Sócio</FONT></strong> </td>		  <td width=116><strong><FONT color=#000000>Anuidade R$</FONT></strong></td>	</tr>		<tr>		  <td width=152 bgcolor="#FFFFFF"><input type="radio" value="SP" name="txtCategoria" onClick="liga(this)">		  Sócio Profissional </td>		  <td width=116 bgcolor="#FFFFFF">20,00 </td>	</tr>		<tr>		  <td width=152 bgcolor="#FFFFFF"><input type="radio" value="SE" name="txtCategoria" onClick="liga(this)">		  Sócio Estudante </td>		  <td width=116 bgcolor="#FFFFFF">10,00</td>	</tr>		<tr>		  <td width=152 bgcolor="#FFFFFF"><input type="radio" value="NS" name="txtCategoria" onClick="liga(this)">		  Não Sócio</td>		  <td width=116 bgcolor="#FFFFFF">----</td>	</tr></table></p><br /><span id="cam"></span><br /><p><input name="acao" value="cadastrar" type="hidden"><input name="Enviar" type="button" value="enviar" /></p></form></body></html>

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.