Código :
stop();
// --------------------------------------------------------------
// función que valida números
// --------------------------------------------------------------
String.prototype.isNumbers = function() {
if (this.length<1) {
return false;
}
for (i=0; i<this.length; i++) {
code = this.charCodeAt(i);
if (this.charAt(i) != " " && code<48 || code>57) {
return false;
}
}
return true;
};
// --------------------------------------------------------------
// valida mails
// --------------------------------------------------------------
String.prototype.isMail = function() {
if (this.indexOf("@")>0 && this.indexOf("@") == this.lastIndexOf("@")) {
if (this.lastIndexOf(".")>this.indexOf("@")+1 && this.lastIndexOf(".")<this.length-2) {
return true;
}
}
};
// --------------------------------------------------------------
// función que limpia los campos
// --------------------------------------------------------------
function limpiar() {
nombrek = "";
empresak = "";
domiciliok = "";
estadok = "";
localidadk = "";
telefonok = "";
mailfromk = "";
comentariosk = "";
mensaje_error = "";
}
// --
nombre.tabIndex = 1;
apellido.tabIndex = 2;
localidad.tabIndex = 3;
estado.tabIndex = 4;
mailfrom.tabIndex = 5;
comentario.tabIndex = 6;
comentarios.tabIndex = 5;
//
bEnviar.onRollOver =function () { this.gotoAndPlay("on");};
bEnviar.onRollOut =function () { this.gotoAndPlay("off");};
bEnviar.onRelease = function() {
if (nombrek.length<1) {
mensaje_error = "Por favor introduzca su nombre";
} else if (apellidok.length<1) {
mensaje_error = "Por favor introduzca su apellido";
} else if (estadok.length<1) {
mensaje_error = "Introduzca un estado o provincia";
} else if (localidadk.length<1) {
mensaje_error = "Por favor introduzca una localidad";
} else if (!mailfrom.text.isMail()) {
mensaje_error = "Por favor introduzca e-mail valido";
} else if (comentariosk.length<3) {
mensaje_error = "Por favor introduzca un comentario";
} else {
loadVariablesNum("form_html.php", 0, "POST");
mensaje_error = "Mensaje enviado";
play();
}
};aqui está el fla con el fomulario funcionado. y aqui el swf
Saludos y gracias
Saludos
