Bonjour, je voulais savoir si mon code est bon, parce que je n'arrive pas à lier 2 select entre eux sans BDD sachant que je voudrais rajouter un lien sur chaque option du deuxième Select :
Merci
Code HTML : 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 <select id="select1" onchange="app_sel(this.value);" > <option value="1">Livres</option> <option value="2">Bande Dessiné</option> <option value="3">Manga</option> </select> <span id="select2"> <select id="select21" style="display:inline;" onChange="location.href=''+this.options[this.selectedIndex].value+'.html';"> <option value="page1">1</option> <option value="page2">2</option> <option value="page3">3</option> </select> <select id="select22" style="display:none;" onChange="location.href=''+this.options[this.selectedIndex].value+'.html';"> <option value="page4">4</option> <option value="page5">5</option> <option value="page6">6</option> </select> <select id="select23" style="display:none;" onChange="location.href=''+this.options[this.selectedIndex].value+'.html';"> <option value="page7">7</option> <option value="page8">8</option> <option value="page9">9</option> </select> </span> <script type="text/javascript"> function app_sel(valeur) { var sels = document.getElementById("select2").getElementsByTagName("select"); for(var i=0,l=sels.length;i<l;i++) { sels.style.display = "none"; } document.getElementById("select2"+valeur).style.display = "inline"; } </script>
Partager