Définition
d’input
Permet de créer un bouton radio. Par définition, un seul bouton radio peut
radio
être coché dans un ensemble
select
Définit une liste de choix (attribut MULTIPLE pour choix multiples)
pattern
Permet de préciser une expression régulière. La valeur du champ devra
respecter la contrainte de la regex pour être valide. pattern="[A-Za-z]
{3}" an input field that can contain only three letters (no numbers or
special characters): pattern=".{8,}" that must contain 8 or more
characters: pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" Must
contain at least one number and one uppercase and lowercase
letter, and at least 8 or more characters.
<input type="email" id="email" name="email" pattern="[a-z0-9._%+-]
Attribut Définition
document.forms.form.champ.focus(); Nom
// -->
</SCRIPT> Bottom of Form
où form est le nom du formulaire, et champ est le
nom du champ. Mais on pourrait utiliser
plutôt document.getElementById('idchamp').focus() (
au lieu de document.forms.form.champ.focus()) si
l'on ajoute l'attribut ID="idchamp" dans la balise de
définition du champ.
Les possibilités liées aux feuilles de styles CSS sont innombrables. Examinez
l'exemple ci-dessous :
<STYLE TYPE="text/css"> Top of Form
<!-- Nom
.etiquette { font-size: smaller; font-
weight: bold; Prénom
color: #ffffff; background:
#999999; cursor: pointer; } J'accepte les
.champ { background: #eeeeee;
border: solid 1px #ffffff; conditions
border-top-color: #888888;
border-left-color: #888888; } Envoyer
.champ:hover,
.champ:focus { border: 1px solid
#6666ff; background: #ffffff; } Bottom of Form
.bouton { color: #000099; font-
weight: bold;
background: #bbbbff; border:
solid 2px #6666ff;
border-top-color: #ffffff;
border-left-color: #ffffff; }
.bouton:hover { color: #6666ff;
background: #ccccff; }
.bouton:focus { background: #bbbbff;
border: solid 2px #ffffff;
border-top-color: #6666ff;
border-left-color: #6666ff; }
-->
</STYLE>
<FORM>
<LABEL FOR="idnom"
CLASS=etiquette>Nom</LABEL>
<INPUT TYPE="TEXT" NAME="nom"
ID="idnom" CLASS=champ><P>
<LABEL FOR="idprenom"
CLASS=etiquette>Prénom</LABEL>
<INPUT TYPE="TEXT"
NAME="prenom" ID="idprenom"
CLASS=champ><P>
<LABEL FOR="idaccept"
CLASS=etiquette>J'accepte les
conditions</LABEL>
<INPUT TYPE="CHECKBOX"
NAME="accepted" ID="idaccept">
<INPUT TYPE="SUBMIT"
CLASS="bouton" VALUE=" Envoyer ">
</FORM>
Explications :