Ver Mensaje Individual
  #7 (permalink)  
Antiguo 10/02/2008, 19:22
alexisfch
 
Fecha de Ingreso: septiembre-2007
Mensajes: 150
Antigüedad: 17 años, 5 meses
Puntos: 1
Exclamación Re: Igualar Botones de Formulario, URGENTE!!

Lo que pasa es que no quiero que me envie el formulario, quiero que me los iguale en pantalla Onclik no Onsubmit, pero no se como se hara CON UN BOTON QUE NO SEA TIPO SUBMIT.



Cita:
Iniciado por caricatos Ver Mensaje
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