Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/01/2011, 11:56
Avatar de Manuellama
Manuellama
 
Fecha de Ingreso: noviembre-2006
Ubicación: Zafra, Extremadura, Spain, Spain
Mensajes: 174
Antigüedad: 17 años, 5 meses
Puntos: 10
Respuesta: Cambiar el valor de variable oculta en evento onclick

<html>
<head>
</head>
<body>
<script>

function cambiarvalor(valor){
if (valor==0){
valor = 1;
}else{
valor =0;
}
document.getElementById('id').value = valor;
}

</script>
<form id="form1" name="form1" method="get" action="">
<input name="id" id="id" type="hidden" value="1" />
<table width="198" border="1" >
<tr>
<td onclick="cambiarvalor(document.getElementById('id' ).value);" >&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>