asd

27

May

Verificar email

Publicado por: LeoBaraldi

Este prototipo es para la clase string y lo que hace es muy simple recibe una cadena y verifica si es una dirección de mail correcta.

Actionscript:
  1. String.prototype.isEmail = function() {
  2. if (!this) {
  3. return false;
  4. }
  5. var iChars = "*|,\":<>[]{}`';()&$#% ";
  6. for (var i = 0; i
  7. if (iChars.indexOf(this.charAt(i)) != -1) {
  8. return false;
  9. }
  10. }
  11. if (this.indexOf("@") == -1) {
  12. return false;
  13. }
  14. if (this.indexOf(".") == -1) {
  15. return false;
  16. }
  17. return true;
  18. };

Ejemplo de uso

Actionscript:
  1. String.prototype.isEmail = function() {
  2. if (!this) {
  3. return false;
  4. }
  5. var iChars = "*|,\":<>[]{}`';()&$#% ";
  6. for (var i = 0; i
  7. if (iChars.indexOf(this.charAt(i)) != -1) {
  8. return false;
  9. }
  10. }
  11. if (this.indexOf("@") == -1) {
  12. return false;
  13. }
  14. if (this.indexOf(".") == -1) {
  15. return false;
  16. }
  17. return true;
  18. };
  19. //Uso:
  20. comprobar_btn.onRelease = function() {
  21. if (mail_txt.text.isEmail() == false) {
  22. status_txt.text = "el email es invalido";
  23. } else {
  24. status_txt.text = "el email es correcto";
  25. }
  26. };

categorias: Prototipos Coment.: -

Publicar comentario

IMPORTANTE: Los comentarios son moderados. A la brevedad seran subidos.

Leonardo David Baraldi

Leonardo Baraldi

Nací en Villa Carlos Paz, tengo 33 años y me dedico a desarrollos para la web desde el año 99, preferentemente en las aéreas de ActionScript y CSS. Trabajo para la firma Manifesto Solutions como jefe de producción.

ultimos post

Usa Firefox es mejor che!!!
Copyright © 2008 LeoBaraldi. Todos los derechos reservados.
Designed by LeoBaraldi and powered by Wordpress | RSS Feed
Love WordPress
Manifesto
Manifesto solutions
Sponsort Oficial de LeoBaraldi