
31/01/2002, 14:55
|
 | | | Fecha de Ingreso: enero-2002 Ubicación: Urano
Mensajes: 577
Antigüedad: 23 años, 4 meses Puntos: 0 | |
Re: Radio button unchecked Te paso este código para que lo veas.
<pre> <html>
<head>
<title> Uno solo </title>
<script language="JavaScript">
<!--
function checkForm(frm){
var x = 0;
for (i=0;i<document.forms[0].length;i++){
if ((document.forms[0].elements[I].type) == "radio"){
x = x + (document.forms[0].elements.checked)?1:0;
}
}
if (x < 1){
alert("No marcó ninguno");
return false;
}
else
document.forms[0].submit();
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="" onsubmit="return checkForm(this);">
<p>Marcar:</p>
<p>
<input type="radio" name="radiobutton" value="op3">
<input type="radio" name="radiobutton" value="op2">
<br>
<input type="submit">
</p>
</form>
</body>
</html>
</pre>
Esta para dos, funciona con cuanto radio lo pongas.
Saludos. |