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

Rispondi quotando