Visualizzazione dei risultati da 1 a 5 su 5

Discussione: email+asp

  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    32

    email+asp

    ciao a tutti io ho trovato questo script
    che controlla il campo Email
    volevo fare in modo che quando
    l'indirizzo email è corretto fosse inviato
    ad una pagina ASP. per esempio posta.asp

    come devo fare?

    --------------
    // Script prepared by Answer Studios / ToUnite.com
    // Version 1.1 (Feb. 1, 2001

    // Logic:
    // 8 steps: Preset elements, 6 error checks, write error (if appicable)

    // --- Presets
    count = 0;
    Err = 0;

    // #1 Check for invalid characters
    // Create an arroay of invalid characters
    invChars = new Array(" ","#","$","%","!","^","~","'","*","(",")",",","<", ">","/","\\");
    // Loop through Array and see if there are any matches, if yes then throw and error.
    for(i=0; i<invChars.length; i++) {
    if (email.indexOf( invChars[i]) >= 0) {
    Err = 1;
    }

    }

    // #2 If passed previous error step >>> Check the @ symbol (1 instance of the symbol)
    if (Err == 0) {
    // Loop by character through the email string for the @ symbol, count the number of instances
    for ( i=0; i < email.length; i++ ) {
    if (email.charAt(i) == "@") {
    count = count + 1;
    }
    }
    // If there is not 1 instance (0 or more than 1) then throw an error.
    if ( count != 1 ) {
    Err = 2;
    }
    }


    // Split the email string by the @ sign, forming the name portion and the domain portion.
    if ( Err == 0 ) {
    splitEmail = email.split("@");
    emailName = splitEmail[0];
    emailDom = splitEmail[1];

    // #3 Verify minimum characters in name portion (minimum of 1), if not throw an error.
    if ( emailName.length < 1 ) {
    Err = 3;
    }

    // #4 Verify there is a . (dot) in the domain portion
    if (emailDom.indexOf(".") < 0) {
    Err = 4;
    } else {

    // #5 Verify a minimum of 2 characters before the dot, if not throw an error.
    // First split the domain portion by the . (dot)
    splitDom = emailDom.split(".");
    if ( splitDom[0].length < 2 ) {
    Err = 5;
    }

    // #6 Verify a minimum of 2 characters after the dot, if not throw an error.
    if ( splitDom[1].length < 2 ) {
    Err = 6;
    }
    }
    }

    // Associate the Err number into the message array for displaying results on the screen.
    ErrMess = [" ","Errore.","Errore.","Errore.","Errore.","Errore. ","Errore."];
    valid = ErrMess[Err];



    ciao

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    32
    mi ero dimenticato

    magari con un messaggio di
    "inviato"

  3. #3
    Utente di HTML.it L'avatar di tigerjack
    Registrato dal
    Aug 2003
    Messaggi
    1,661
    questa la funzione di convalida:
    codice:
    // Script prepared by Answer Studios / ToUnite.com
    // Version 1.1 (Feb. 1, 2001
    // Logic:
    // 8 steps: Preset elements, 6 error checks, write error (if appicable)
    // --- Presets
    function convalida() {
        count = 0;
        Err = 0;
        // #1 Check for invalid characters
        // Create an arroay of invalid characters
        invChars = new Array(" ", "#", "$", "%", "!", "^", "~", "'", "*", "(", ")", ",", "<", ">", "/", "\\");
        // Loop through Array and see if there are any matches, if yes then throw and error.
        for (i=0; i<invChars.length; i++) {
            if (email.indexOf(invChars[i])>=0) {
                Err = 1;
            }
        }
        // #2 If passed previous error step >>> Check the @ symbol (1 instance of the symbol)
        if (Err == 0) {
            // Loop by character through the email string for the @ symbol, count the number of instances
            for (i=0; i<email.length; i++) {
                if (email.charAt(i) == "@") {
                    count = count+1;
                }
            }
            // If there is not 1 instance (0 or more than 1) then throw an error.
            if (count != 1) {
                Err = 2;
            }
        }
        // Split the email string by the @ sign, forming the name portion and the domain portion.
        if (Err == 0) {
            splitEmail = email.split("@");
            emailName = splitEmail[0];
            emailDom = splitEmail[1];
            // #3 Verify minimum characters in name portion (minimum of 1), if not throw an error.
            if (emailName.length<1) {
                Err = 3;
            }
            // #4 Verify there is a . (dot) in the domain portion
            if (emailDom.indexOf(".")<0) {
                Err = 4;
            } else {
                // #5 Verify a minimum of 2 characters before the dot, if not throw an error.
                // First split the domain portion by the . (dot)
                splitDom = emailDom.split(".");
                if (splitDom[0].length<2) {
                    Err = 5;
                }
                // #6 Verify a minimum of 2 characters after the dot, if not throw an error.
                if (splitDom[1].length<2) {
                    Err = 6;
                }
            }
        }
        // Associate the Err number into the message array for displaying results on the screen.
        ErrMess = ["L'e-mail è stata inviata", "Carattere non valido!", "Hai dimenticato la 'chiocciolina'!", "Il tuo nome deve essere di almeno di un carattere!", "Manca il puntino!", "Il dominio del tuo ISP deve essere almeno di due caratteri!", "Il suffisso deve essere almeno di due caratteri (es.:it,com)!"];
        valid = ErrMess[Err];
        if (valid == "L'e-mail è stata inviata") {
            loadVariablesNum("pagina.asp", 0, "POST");
        }
        trace(valid);
    }

    crea un campo di testo di tipo input e gli associ il nome della variabile email

    al pulsante:
    on (release) {
    convalida();
    }

    poi ci sarebbe la guida:
    http://flash-mx.html.it/guide/view_l...dguida=6&id=85

    se vuoi l'esempio che ti ho preparato.. metti la e-mail


    tiger
    figlio perso e MAI ritrovato....?

  4. #4
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    32
    ok
    ecco la mail
    butasa@libero.it

    grazie e ciao

  5. #5
    Utente di HTML.it L'avatar di tigerjack
    Registrato dal
    Aug 2003
    Messaggi
    1,661
    inviato



    tiger
    figlio perso e MAI ritrovato....?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.