Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/09/2011, 15:38
dleal100
 
Fecha de Ingreso: septiembre-2011
Mensajes: 158
Antigüedad: 12 años, 7 meses
Puntos: 15
porque mi formulario no asepta la funcion onsubmit

ayuda foreros tengo un formulario y cuando uso onsubmit no me funciona, y no quiero usar onclick porque todo el mundo cuando envia sus datos preciona la tecla enter
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" xml:lang="es" lang="es" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>titulo</title>
</head>
<script type="text/javascript">
function validar(){
var nombre= document.getElementById("nombre").value;
var password= document.getElementById("password").value;
//alert(nombre +password);
document.getElementById("aca").innerHTML=nombre+" "+password;
}
</script>

<style type="text/css">
label{width:100px;
display:inline-block;
}
</style>


<body>

<form method="post" action="">
<fieldset>
<legend>formulario o_o</legend>
<label>Nombre:</label><input type="text" id="nombre" /><br /><br />
<label>password:</label><input type="password" id="password" /><br /><br />
<label></label><input type="button" value="caca" onsubmit="validar()"/>
</fieldset>
</form>

<div id="aca"></div>


</body>
</html>