no save
Assistance
Achat
News

Forum | webmastering
[HTML - Javascript] Menu déroulants cascade
Charly25, le ven. 13 mai 2005 à 17:00:56
Re,
Je l'ai retrouvé !!

<html>
<!-- Date de création: 24/12/2003 -->
<head>
<title>menus deroulants liés</title>
<SCRIPT LANGUAGE="JavaScript">
menu=new Array()
// Rajoutez un élément au tableau menu pour chaque categorie supplémentaire
// De la même façon, pensez à modifier le formulaire pour rajouter des categories.
menu[0]=new Array()
menu[1]=new Array()
menu[2]=new Array()
menu[3]=new Array()
menu[4]=new Array()
menu[5]=new Array()
menu[6]=new Array()
menu[7]=new Array()
// Modifiez ici les variables pour les menus deroulant
menu[0][0]=new Option("1")
menu[1][0]=new Option("2")
menu[2][0]=new Option("3")
menu[3][0]=new Option("4")
menu[4][0]=new Option("5")
menu[5][0]=new Option("6")
menu[6][0]=new Option("7")
menu[7][0]=new Option("8")
// Ne rien modifier sous cette ligne
function changeSousTheme(numeroMenu){
for (i=document.menuDeroulant.sousTheme.options.length-1;i>0;i--){
document.menuDeroulant.sousTheme.options[i]=null
}
for (i=0;i<menu[numeroMenu].length;i++){
document.menuDeroulant.sousTheme.options[i]=new Option(menu[numeroMenu][i].text,menu[numeroMenu][i].value)
}
document.menuDeroulant.sousTheme.selectedIndex=0
}
function selectmenu(theme_prin){
if (theme_prin.theme.options[theme_prin.theme.selectedIndex].value == "null"){
alert('selectionnez d\'abord une personne');
}
else{
window.top.location.href = theme_prin.theme.options[theme_prin.theme.selectedIndex].value;
}
}
function destination(){
var destination = document.menuDeroulant.sousTheme.options[document.menuDeroulant.sousTheme.selectedIndex].value;
if(destination=="null"){
alert('Veuillez saisir une destination valide!');
}
else{
window.top.location.href = destination;
}
}
</SCRIPT>
</head>
<body>
<FORM NAME="menuDeroulant">
<SELECT NAME="theme" SIZE=1 onChange="selectmenu(this.form)">
<OPTION selected VALUE="null">-=Prénom=-</option>
<OPTION VALUE="Javascript:changeSousTheme(0)">François</option>
<OPTION VALUE="Javascript:changeSousTheme(1)">Eric </option>
<OPTION VALUE="Javascript:changeSousTheme(2)">Marie-Laure</option>
<OPTION VALUE="Javascript:changeSousTheme(3)">Christophe</option>
<OPTION VALUE="Javascript:changeSousTheme(4)">Stéphane</option>
<OPTION VALUE="Javascript:changeSousTheme(5)">Eric</option>
<OPTION VALUE="Javascript:changeSousTheme(6)">Patrick</option>
<OPTION VALUE="Javascript:changeSousTheme(7)">Alexandre</option>
</SELECT>
<br>
numero
<SELECT NAME="sousTheme">
<OPTION VALUE="null">num</option>
</SELECT>
<input type="reset" value="Effacer">
</FORM>
</body>
</html>

Essaye et dis moi si c'est ce que tu cherchais.


PrécédentCharly25
mai 05
sam3000
mai 05
Suivant
REPONSES
sam3000
mai 05
reinearthur
mai 05
Charly25
mai 05
Charly25
mai 05
sam3000
mai 05
reinearthur
mai 05
reinearthur
mai 05
Tukaram
mars 06
Gwen
sept. 06
rf92
juin 07
Version Web
Réalisé par RedShift
no save