Ver Mensaje Individual
  #6 (permalink)  
Antiguo 10/02/2008, 16:25
Avatar de caricatos
caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años, 11 meses
Puntos: 1284
Re: Igualar Botones de Formulario, URGENTE!!

Hola:

Las validaciones por regla general deben hacerse en el tag form (tal como puse más arriba)...

Prueba así:

Código:
<!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=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>
<script language="JavaScript">
function tag(id) {return document.getElementById(id);
}
</script>

<body>
<form id="form1" name="form1" method="post" action="" onsubmit="return (nombre2.value==nombre1.value) && (tag('radio1').checked == tag('radio3').checked)">
  <p>
    <label></label>
    </p>
  <table width="200" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>Primero</td>
      <td><input name="nombre1" type="text" id="nombre1" value="Juanito Perez" /></td>
    </tr>
    <tr>
      <td>Segundo</td>
      <td><input type="text" name="nombre2" id="nombre2" /></td>
    </tr>
  </table>
  <br />
  <table width="200" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>Primero</td>
      <td><input type="radio" name="radio1" id="radio1" value="Si" checked="checked" />
        <input type="radio" name="radio1" id="radio2" value="No"/></td>
    </tr>
    <tr>
      <td>Segundo</td>
      <td><input type="radio" name="radio3" id="radio3" value="Si2"/>
        <input type="radio" name="radio3" id="radio4" value="No2"/></td>
    </tr>
  </table>
  <p>
    <input type="submit" name="enviar" value="Enviar Datos" id="enviar" />
  </p>
  <p>&nbsp;</p>
</form>
</body>
</html>
Tienes algunas cosas mal... el return debe implicar todas las comparaciones, debe estar en el tag form (onsubmit); el botón siempre debe ser tipo submit...

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo