Exemples Cours
Exemples Cours
Exemples Cours
1. <input>
2. <select>
3. <textarea>
4. <button>
<form action="/action_page.php">
<fieldset>
<legend>Personalia:</legend>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John
"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"
><br><br>
<input type="submit" value="Submit">
</fieldset>
</form>
6. <datalist>
<form action="/action_page.php">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
7. <output>
<form action="/action_page.php"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
0
<input type="range" id="a" name="a" value="50">
100 +
<input type="number" id="b" name="b" value="50">
=
<output name="x" for="a b"></output>
<br><br>
<input type="submit">
</form>
Les différents types d’input
Input Type Text
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
<form>
<label for="username">Username:</label><br>
<input type="text" id="username" name="username"><br>
<label for="pwd">Password:</label><br>
<input type="password" id="pwd" name="pwd">
</form>
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John">
<br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><
br><br>
<input type="submit" value="Submit">
</form>
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John">
<br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><
br><br>
<input type="submit" value="Submit">
<input type="reset">
</form>
<form>
<input type="radio" id="male" name="gender" value="male"
>
<label for="male">Male</label><br>
<input type="radio" id="female" name="gender" value="fem
ale">
<label for="female">Female</label><br>
<input type="radio" id="other" name="gender" value="othe
r">
<label for="other">Other</label>
</form>
<form>
<input type="checkbox" id="vehicle1" name="vehicle1" val
ue="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" val
ue="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" val
ue="Boat">
<label for="vehicle3"> I have a boat</label>
</form>
<form>
<label for="favcolor">Select your favorite
color:</label>
<input type="color" id="favcolor" name="favcolor">
</form>
<form>
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" name="birthday">
</form>
You can also use the min and max attributes to add restrictions to
dates:
<form>
<label for="datemax">Enter a date before 1980-01-
01:</label>
<input type="date" id="datemax" name="datemax" max="1979
-12-31"><br><br>
<label for="datemin">Enter a date after 2000-01-
01:</label>
<input type="date" id="datemin" name="datemin" min="2000
-01-02">
</form>
<form>
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email">
</form>
<form>
<label for="myfile">Select a file:</label>
<input type="file" id="myfile" name="myfile">
</form>
<form>
<label for="bdaymonth">Birthday (month and
year):</label>
<input type="month" id="bdaymonth" name="bdaymonth">
</form>
<form>
<label for="quantity">Quantity (between 1 and
5):</label>
<input type="number" id="quantity" name="quantity" min="
1" max="5">
</form>
GET POST
Marque-page et historique de Les paramètres de l’URL sont L’URL est enregistrée sans paramètres
navigation stockés en même temps que URL.
l’URL.
Cache et fichier log du Les paramètres de l’URL sont Les paramètres de l’URL ne sont pas
serveur stockés sans chiffrement enregistrés automatiquement.
Comportement lors de Les paramètres de l’URL ne sont Le navigateur avertit que les données
l’actualisation du navigateur / pas envoyés à nouveau. du formulaire doivent être renvoyées.
Bouton « précédent »