DEMONSTRATION :
Vérifier la saisie correcte d'une adresse E-Mail :
INSTALLATION DU SCRIPT :
Le code à insérer dans la partie
<HEAD>
et
</HEAD>
:
<SCRIPT LANGUAGE="JavaScript"> <!-- /************************************************************************* * APPLICATION : Verifier la saisie correcte d'une adresse E-Mail * * RECUPERE A L ADRESSE : http://www.asi.fr/~ericbon/htmldoc.htm * **************************************************************************/ function emailCheck() { txt=document.isn.email.value; if ((txt.indexOf(" ")!=-1)) { alert("Désolé, mais les adresses E-Mail ne comportent pas d'éspace !"); return; } if ((txt.indexOf("@")==-1)) { alert("Désolé, mais les adresses E-Mail comportent un caractère '@' !"); return; } if (txt.indexOf("@")<2) { alert("Désolé, mais l'adresses est incorrecte !\n Vérifier le texte devant le caractère '@'"); return; } parent.location.href='mailto:' + txt; } // End --> </SCRIPT>
Le code à insérer dans l'instruction
<BODY>
:
Le code à insérer dans la partie
<BODY>
et
</BODY>
:
<FORM NAME="isn"> <INPUT TYPE="text" NAME="email" SIZE=40 VALUE=""><BR> <INPUT TYPE="button" NAME="email1" VALUE="Tester l'adresse" onClick="emailCheck()"> </FORM> <BR><BR>