Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/11/2009, 11:23
Avatar de syntex
syntex
 
Fecha de Ingreso: noviembre-2002
Ubicación: Cataluña
Mensajes: 978
Antigüedad: 21 años, 6 meses
Puntos: 4
Problemas al cargar <div con un checkbox

Hola foreros,

Encontre este script donde apretando el checkbox te abre un <div>, pero cuando le doy al submit con el valor del checkbox "si" no se me abre el div, porque?

Código HTML:
<html>
<head>
<title>CB Hide/Show</title>
<script type="text/javascript">
<!--
function showMe (it, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = vis;
}
//-->
</script>
</head>
<body>
<form action="" method="get">
<?
	if ($_GET[c1] == "si"){$ZX1 = "checked";}

?>
<input type="checkbox" name="c1" onClick="showMe('div1', this)" value="si" <? echo $ZX1; ?>>Show Hide Checkbox
<input type="submit"  value="">
<div id="div1" style="display:none">
	<table border=1 id="t1">
	<tr>
	<td>i am here!</td>
	</tr>
	</table>
</div>

</form>
</body>
</html> 
A ver si alguien puede modificar el script para que cuando aprete el boton submit y el valor del checkbox sea "si"me indique el <div id="div1" style="display:none">

Gracias.
__________________
------------------------------------------------
La paciencia es el rey de la ciencia
------------------------------------------------