| ||||
function Validar(form) { if (form.NombreDelObjeto.value == "") { alert("Leyenda a mostrar"); form.NombreDelObjeto.focus(); return; } form.submit(); } en el boton de envio del formulario pone: onclick="Validar(this.form)" Saludos |
| ||||
<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script> function Validar(frm) { if (frm.txtPW.value == "") { alert("debe ingresar la password"); form.txtPW.focus(); return; } frm.submit(); } </script> </head> <body> <table width="165" height=112 border=0 cellpadding=0 cellspacing=0> <form name="frm" action="http://www.colegioelectronico.com/coe/session/chkUser.php3" method="post" target="_blank"> <tbody> <tr bgcolor="#ffffff"> <td height=10 colspan="4"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#000056"> <img src="http://usuarios.lycos.es/maralbust/imagenes/intranet.gif" width="161" height="10"> </font></strong></font><br> <img src="http://usuarios.lycos.es/maralbust/imagenes/spacer.gif" width="1" height="1" border="0"></td> </tr> <tr> <td width=16 height=10></td> <td width=55 height=10><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Usuario</strong></font></td> <td width=50 height=10><input type="text" name="txtNOMBRE" size="10" maxlength="10"></td> <td width=44 height=10></td> </tr> <tr> <td width=16 height=10></td> <td width=55 height=10></td> <td width=50 height=10><img height=3 src="http://usuarios.lycos.es/maralbust/botones/spacer.gif" width=1> </td> <td width=44 height=10></td> </tr> <tr> <td width=16 height=10></td> <td width=55 height=10><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Password</strong></font></td> <td width=50 height=10><input type="password" name="txtPW" size="10" maxlength="10"></td> <td width=44 height=10></td> </tr> <tr> <td width=16 height=10></td> <td width=55 height=10></td> <td width=50 height=10><img height=8 src="http://usuarios.lycos.es/maralbust/botones/spacer.gif" width=1> </td> <td width=44 height=10></td> </tr> <tr> <td width=16 height=32></td> <td width=55 height=32></td> <td width=50 height=32> <input name="image" type="image" src="http://usuarios.lycos.es/maralbust/imagenes/btnentrar.gif" onclick="Validar(this.form)"></td> <td width=44 height=32></td> </tr> </form> </table> </body> </html> dime si esta mal, por que me sale el mensaje pero entra igual (obviamente con error. |