Salut à tous,
Je souhaite créer une fonction javascipt qui ordonne à mes <select> de séléctionner leur premier <option>.
Voici ce que j'ai tenté.
Merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 function resetFromTo() { document.getElementById('from').selectedIndex = 0; document.getElementById('to').selectedIndex = 0; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 du <select id="from" name="from" <? if (!$enabled) print "disabled";?>> <option></option><? for ($i=0; $i < sizeof($dates); $i++) {?> <option value="<? print $dates[$i];?>" <? if (!empty($_GET['from']) && $_GET['from']==$dates[$i]) print "selected";?>> <? print convertDate($dates[$i]);?> </option><? }?> </select> au <select id="to" name="to" <? if (!$enabled) print "disabled";?>> <option></option><? for ($i=0; $i < sizeof($dates); $i++) {?> <option value="<? print $dates[$i];?>" <? if (!empty($_GET['to']) && $_GET['to']==$dates[$i]) print "selected";?>> <? print convertDate($dates[$i]);?> </option><? }?> </select>
Partager