1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| <html><head>
<script type="text/javascript">
function verif()
{
tableau = document.getElementsByTagName("input") ;
n = tableau.length ;
compteur = 0 ;
for ( i=0; i<n; i++ )
{
if ( tableau[i].type=="checkbox" && tableau[i].checked )
{
action = tableau[i].value ;
compteur++ ;
}
}
if ( compteur == 1 )
log = " " ;
else
log = "Vous devez cocher une checkbox ! " ;
chaine = document.getElementById('emad').value ;
if ( ! /^[\w.-]+@[a-z0-9.-]{2,}\.[a-z]{2,6}$/.test(chaine ) )
log = "Syntaxe adresse-mail incorrecte" ;
document.getElementById('msg').innerHTML = log ;
document.getElementById('emad').focus() ;
if ( log == " " )
{
message = "A la place de cette boite de dialogue,\r\n" ;
message += "et à l'aide de window.opener.location.replace, \r\n" ;
message += "vous solliciterez une nouvelle page,\r\n" ;
message += "avec en query-string : ?mail=" + chaine + "&action=" + action + " !" ;
alert (message) ;
window.close();
}
}
</script>
</head><body style="font: 16px verdana;" onload="document.getElementById('emad').focus()">
<br><label>e-mail address :</label>
<br><input name="address" id="emad" type="text" maxlength="40" style="width: 300px;" value="">
<br><input type="checkbox" value="inscription" > : Inscription
<br><input type="checkbox" value="desinscription"> : Desinscription
<br><input type="checkbox" value="contact"> : Nous contacter
<br>
<br><input type="submit" value="Submit" onclick="verif()">
<span id="msg" style="font: italic 16px Times; color: red;"></span>
</body></html> |
Partager