
25/03/2005, 03:47
|
 | /** @package Moderador */ | | Fecha de Ingreso: julio-2004 Ubicación: sèveR led onieR lE
Mensajes: 9.368
Antigüedad: 20 años, 7 meses Puntos: 102 | |
Código:
<html><head><title></title><script language="javascript">
function chkForm(){
chk=document.getElementsByTagName('input');
a:chk.length;
num=0;
for(i=0;i<chk.length;i++)
if(chk[i].checked) num++
if(num==0) {
alert("Debes seleccionar al menos uno");
chk[0].checked=true;
}
}
</script></head><body>
<FORM action="test.php" method="POST" name="formulario">
<?php
for($i=1;$i<=5;$i++){
echo "<input type=\"checkbox\" value=\"$i\" name=\"chk[]\"><br>";
}
?>
<INPUT TYPE="button" name="btn" value="Test" onClick="javascript:chkForm();">
</FORM> </body></html>
Saludos! |