Tema: Formulario
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/11/2002, 16:33
fosforito
Invitado
 
Mensajes: n/a
Puntos:
espero esto te ayude amigo solo copialo y salvalo con el nombre que tu quieras y has la prueba:
suerte

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>e-mail us</title>
<link rel="stylesheet" href="code1.css">
</head>

<body bgcolor="#8B0901">
<center>
<!--------------------------------------BEGIN REQUIRED----------------------------------------->
<!--BEGIN THE FORM-->
<table style="border:3 solid #339999" bgcolor="#DAD7F2" width="80%" height="10"><tr><td>
<p id="p2">
<form name="main" method="get" action="http://www.melodysoft.com/cgi-bin/form.cgi"><!--esto no lo cambies -->
*Nombre &nbsp;&nbsp;<input type="text" width="20" name="name" style="border:1 solid #000000">
*E-mail &nbsp;&nbsp;<input type="text" width="20" name="email" style="border:1 solid #000000">
<br>
Asunto &nbsp;&nbsp;<input type="text" width="20" name="subject" size="30" style="border:1 solid #000000">
<br>
<b>Comentarios</b><br>
<TEXTAREA style="FONT-SIZE: 11px; WIDTH: 500px; COLOR: navy; FONT-FAMILY: tahoma,arial; BACKGROUND-COLOR: white" name=Comments rows=6 wrap=VIRTUAL cols=30></TEXTAREA>
<center><input type="button" value="Enviar" onClick="javascript:validate();" style="border:1 solid #000000; cursor:pointer; cursor:hand; width:120"> <input type="reset" value="Borrar" style="border:1 solid #000000; cursor:pointer; cursor:hand; width:120"></center>
<input type="hidden" name="recipient" value="[email protected]"><!--ejemplo [email protected]-->
<input type="hidden" name="redirect" value="http://www.tupagina.com"><!--ejemplo supone que estas en geocities la direccion seria http://www.geocities.com/mipagina/"-->
</form>
</font>
</td></tr>
</table>
<!--END THE FORM-->

<!--BEGIN FORM VALIDATION SCRIPT-->
<script language="JavaScript1.2">
/* Written by Premshree Pillai
Created 2:22 PM 5/12/02
http://www.qiksearch.com
[email protected] */
/* Visit http://www.qiksearch.com/javascripts.htm for FREE scripts */
/* Location of script : http://www.qiksearch.com/javascripts/form-validator.htm */

var alphaChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL MNOPQRSTUVWXYZ ";
var numChars="0123456789";
var error;
var error_n;
var error_ad;
var error_a;
var error_z;
var errormsg;

//--------------------------Customise-------------------------------
var isNameReq=true; // True si el campo del nombre es requerido tambien puedes poner False
var isEmailReq=true; // True si el campo del E-mail es requerido tambien puedes poner False
//------------------------------------------------------------------

function reset_error()
{
error_n=false;
error_ad=false;
error_a=false;
error_z=false;
errormsg='Ha ocurrido un error ::\n_____________________________\n\n';
}
<!--Name-->
function validate_name()
{
if(isNameReq)
{
if(document.main.name.value=="")
{
errormsg+='Por favor escriba su nombre.\n';
error_n=true;
document.main.name.focus();
}
}
for(var i=0; i<document.main.name.value.length; i++)
{
for(var j=0; j<alphaChars.length; j++)
{
if(alphaChars.charAt(j)==document.main.name.value. charAt(i))
{
break;
}
else
{
if(j==(alphaChars.length-1))
{
errormsg+='"' + document.main.name.value.charAt(i) + '"' + ' es invalido caracter para el nombre.\n';
error_n=true;
}
}
if(error_n)
{
document.main.name.select();
}
}
}
}



<!--E-mail-->
function validate_email()
{
if(isEmailReq)
{
if(document.main.email.value.search("@") == -1 || document.main.email.value.search("[.*]") == -1)
{
errormsg+='Por favor escriba su E-mail.\n';
error_ad=true;
if(!error_n)
{
document.main.email.focus();
}
}
}
}
<!--continuing-->


function validate()
{
reset_error();
validate_name();
validate_email();

if(error_n||error_ad||error_a||error_z)
{
error=true;
}
else
{
error=false;
}
if(!error)
{
document.main.submit();
}
else
{
alert(errormsg);
}
}

</script>
<!--END FORM VALIDATION SCRIPT-->