HTML DOM Checkbox propriété type
Définition et utilisation
Type propriété renvoie le type d'élément de formulaire.
Pour un objet de case à cocher, la propriété retourne toujours "case".
grammaire
checkboxObject.type
support du navigateur
Tous les principaux navigateurs supportent type d'attribut
Exemples
Exemples
L'exemple suivant renvoie un type case élément de formulaire:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Titre> Ce tutoriel (w3big.com) </ title>
<Script>
fonction displayResult () {
var x = document.getElementById ( "check1") type .;
alerte (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "checkbox" id = "check1"> aimez-vous été?
</ Form>
<Bouton type = "button" onclick = "displayResult ()"> input type d'affichage </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Titre> Ce tutoriel (w3big.com) </ title>
<Script>
fonction displayResult () {
var x = document.getElementById ( "check1") type .;
alerte (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "checkbox" id = "check1"> aimez-vous été?
</ Form>
<Bouton type = "button" onclick = "displayResult ()"> input type d'affichage </ button>
</ Body>
</ Html>
Essayez »
objets Checkbox