Charger Posté 11 Août 2013 Posté 11 Août 2013 Bonjour, j'ai enfin réussi à adapter le script suivant pour mon site Wordpress: http://www.dynamicdrive.com/dynamicindex1/chainedmenu/ Le problème: je souhaite afficher 2 formulaires différents mais cela ne fonctionne pas. Je suis obligé de supprimer une des listes du fichier config.js pour que le formulaire restant apparaisse. Ci-dessous mon code HTML <html> <head> <title>Chained Selects</title> <script language="javascript" src="chainedmenu.js"> /*********************************************** * Chained Select Menu- By Xin Yang (http://www.yxscripts.com/) & Dynamic Drive (http://dynamicdrive.com) * Script featured on/available at http://www.dynamicdrive.com/ * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code * This notice must stay intact for legal use! ***********************************************/ </script> <script language="javascript" src="config.js"></script> </head> <body onLoad="initListGroup('minofa', document.listmenu2.firstlevel, document.listmenu2.secondlevel, 'savestate'); initListGroup('akako', document.listmenu1.firstlevel, document.listmenu1.secondlevel, 'savestate1')"> <form name="listmenu2"> <table align="center"><tr> <td><select name="firstlevel" style="width:180px;"></select></td> <td><select name="secondlevel" style="width:160px;"></select></td> <td><input type="button" value="Go" onClick="goListGroup(document.listmenu2.firstlevel, document.listmenu2.secondlevel)"> <input type="button" value="Reset" onClick="resetListGroup('minofa')"> </tr></table> </form> <form name="listmenu1"> <table align="center"><tr> <td><select name="firstlevel" style="width:180px;"></select></td> <td><select name="secondlevel" style="width:160px;"></select></td> <td><input type="button" value="Go" onClick="goListGroup(document.listmenu1.firstlevel, document.listmenu1.secondlevel)"> <input type="button" value="Reset" onClick="resetListGroup('akako')"> </tr></table> </form> </body> </html> Code config.js ci-dessous //var hide_empty_list=true; //uncomment this line to hide empty selection lists var disable_empty_list=true; //uncomment this line to disable empty selection lists var onclickaction="goto" //set to "alert" or "goto". Former is for debugging purposes, to tell you the value of the final selected list that will be used as the destination URL. Set to "goto" when below configuration is all set up as desired. var newwindow=0 //Open links in new window or not? 1=yes, 0=no. /////DEFINE YOUR MENU LISTS and ITEMS below///////////////// /////MENU 1///////////////// addListGroup("minofa", "First-Select"); addOption("First-Select", "Select an item", "", 1); //HEADER OPTION addList("First-Select", "Webmaster Resources", "", "Webmaster"); addList("First-Select", "News Sites", "", "News"); addList("First-Select", "Car Sites", "", "Cars"); addOption("Webmaster", "Select an item", "", 1); //HEADER OPTION addList("Webmaster", "JavaScript Links", "http://www.codingforums.com"); addList("Webmaster", "PHP Links", "", "Webmaster-PHP"); addOption("Webmaster", "CodingForums.com", "http://www.codingforums.com"); //END OF THIS NODE addOption("Webmaster-JavaScript", "Select an item", "", 1); //HEADER OPTION addOption("Webmaster-JavaScript", "JavaScript Kit", "http://www.javascriptkit.com"); addOption("Webmaster-JavaScript", "Dynamic Drive", "http://www.dynamicdrive.com"); addOption("Webmaster-JavaScript", "JavaScript Reference", "http://www.javascriptkit.com/jsref/"); addOption("Webmaster-PHP", "Select an item", "", 1); //HEADER OPTION addOption("Webmaster-PHP", "PHP.net", "http://www.php.net"); addOption("Webmaster-PHP", "mySQL", "http://www.mysql.com"); addOption("News", "Select an item", "", 1); //HEADER OPTION addList("News", "General News", "", "News-General"); addList("News", "Tech News", "", "News-Tech"); addOption("News-General", "Select an item", "", 1); //HEADER OPTION addOption("News-General", "CNN", "http://www.cnn.com"); addOption("News-General", "MSNBC", "http://www.msnbc.com"); addOption("News-General", "BBC News", "http://news.bbc.co.uk"); addOption("News-General", "Fox News", "http://www.foxnews.com"); addOption("News-Tech", "Select an item", "", 1); //HEADER OPTION addOption("News-Tech", "News.com", "http://www.news.com"); addOption("News-Tech", "Wired News", "http://www.wired.com"); addOption("News-Tech", "TheRegister", "http://www.theregister.com"); addOption("Cars", "Select an item", "", 1); //HEADER OPTION addList("Cars", "Regular Cars", "", "Cars-Regular"); addList("Cars", "Sports Cars", "", "Cars-Sports"); addOption("Cars-Regular", "Select an item", "", 1); //HEADER OPTION addOption("Cars-Regular", "Toyota", "http://www.toyota.com"); addOption("Cars-Regular", "Ford", "http://www.ford.com"); addOption("Cars-Regular", "Nissan", "http://www.nissanusa.com"); addOption("Cars-Regular", "BMW", "http://www.bmw.com"); addOption("Cars-Sports", "Select an item", "", 1); //HEADER OPTION addOption("Cars-Sports", "Porsche", "http://www.www.porsche.com"); addOption("Cars-Sports", "Aston Martin", "http://www.astonmartin.com"); /////MENU 2///////////////// addListGroup("akako", "Kouki"); addOption("Kouki", "Select an item", "", 1); //HEADER OPTION addList("Kouki", "Michou", "", "Michouko"); addOption("Michouko", "Select an item", "", 1); //HEADER OPTION addList("Michouko", "JavaScript Links", "http://www.codingforums.com"); addList("Michouko", "PHP Links", "", "Michouko-PHP"); addOption("Michouko", "CodingForums.com", "http://www.codingforums.com"); //END OF THIS NODE addOption("Michouko-Pono", "Select an item", "", 1); //HEADER OPTION addOption("Michouko-Pono", "JavaScript Kit", "http://www.javascriptkit.com"); addOption("Michouko-Pono", "Dynamic Drive", "http://www.dynamicdrive.com"); addOption("Michouko-Pono", "JavaScript Reference", "http://www.javascriptkit.com/jsref/"); addOption("Michouko-Caco", "Select an item", "", 1); //HEADER OPTION addOption("Michouko-Caco", "PHP.net", "http://www.php.net"); addOption("Michouko-Caco", "mySQL", "http://www.mysql.com"); Faites pas attention aux derniers noms, j'en avais par dessus la tête... Avec les codes ci-dessus, seul le premier formulaire s'affiche, le second étant vide. Si quelqu'un a une idée de la modif à faire pour que les deux formulaires s'affichent... Merci
Sujets conseillés
Veuillez vous connecter pour commenter
Vous pourrez laisser un commentaire après vous êtes connecté.
Connectez-vous maintenant