<script type="text/javascript">
function pulsar(e) {
tecla = (document.all) ? e.keyCode : e.which;
return (tecla != 13);
}
</script>
<!-- -->
<form action="loquesea.asp" onkeypress = "return pulsar(event)">
<input type="text" />
<input type="submit" />
</form>
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1695"></script>
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = stopRKey;
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1694"></script>
<html>
<body>
<form id="myForm">
Firstname: <input id="fname" type="text" value="Mickey" />
Lastname: <input id="lname" type="text" value="Mouse" />
<input id="sub" type="button" value="Submit" />
</form>
<p>Get the value of all the elements in the form:<br />
<script type="text/javascript">
var x=document.getElementById("myForm");
for (var i=0;i<x.length;i++)
{
document.write(x.elements[i].value);
document.write("<br />");
}
</script>
</p>
</body>
</html>
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1297"></script>
Esto lo realizan normalmente los navegadores cuando dentro de un formulario hay alguna forma estándar de hacer el submit, pero en el caso de que no queramos poner botón de submit, tendremos que ejecutar el siguiente código en el evento onkeypress de la caja.
Extraido de www.sentidoweb.com
<html>
<head>
<title>Enviar formulario al pulsar un enlace</title>
<script>
function enviar_formulario(){
document.formulario1.submit()
}
</script>
</head>
<body>
<form action="pagina_destino.php" method=post name="formulario1">
<input name="nombre" onkeypress="if (event.keyCode == 13) enviar_formulario()"/>
</form>
</body>
</html>
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/768"></script>
<html>
<head>
<title>Enviar formulario al pulsar un enlace</title>
<script>
function enviar_formulario(){
document.formulario1.submit()
}
</script>
</head>
<body>
<form action="pagina_destino.php" method=post name="formulario1">
<input type="hidden" name="campo1" value="valor">
<input type="hidden" name="campo2" value="otroValor">
</form>
<a href="javascript:enviar_formulario()">Enviar formulario</a>
</body>
</html>
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/767"></script>
function nif_valido(campo)
{
abc=campo.value
nif=abc.substring(0,abc.length-1)
let=abc.charAt(abc.length-1)
if (!isNaN(let))
{
alert('El nif debe tener 8 digitos y una letra al final ')
campo.focus()
return false
}
else
{
cadena="TRWAGMYFPDXBNJZSQVHLCKET"
posicion = nif % 23
letra = cadena.substring(posicion,posicion+1)
if (letra!=let.toUpperCase())
{
alert("NIF incorrecto.Revise la letra y no deje espacios. ")
campo.focus()
return false
}
}
return(true)
}
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/681"></script>