// JavaScript Document /*Variables à définir :*/ /*value du select correspondant à la réservation de l'établissement en totalité*/ var full_type = 5; /*Nb maximum de chambres dans l'établissement*/ var room_max = 5; /*Nb de chambres max. réservable par type*/ var nb_room_booking = 3; /*Message avec détection de la lang si sélection d'un nombre de chambre inférieur au type "full"*/ if (navigator.browserLanguage) var language = navigator.browserLanguage; else var language = navigator.language; if (language.indexOf('fr') > -1) var message_full_type = "Vous ne pouvez pas s\351lectionner \n un nombre de chambre inf\351rieur \n avec ce type de tarif."; else if (language.indexOf('en') > -1) var message_full_type = "You can't select a number of room under this type of price."; else var message_full_type = "Vous ne pouvez pas s\351lectionner \n un nombre de chambre inf\351rieur \n avec ce type de tarif."; /* selon type de prix application du nom de chambre max de l'établissement*/ function def_room(val1,val2) { var price_selected; price_selected = val1.options[val1.selectedIndex].value; if (price_selected==full_type) { val2.options.length = 1; val2.options[0].value = room_max; val2.options[0].text = ''+room_max; val2.options.selectedIndex = 0;} else { val2.options.length = nb_room_booking; for (i=1; i<=nb_room_booking; i++){ val2.options[i-1].value = i; val2.options[i-1].text = ''+i; } val2.options.selectedIndex = 0; } } /* sinon construction menu déroulant avec nb de chambre max réservable en fonction du type*/ function verifval1(val1,val2) { var price_selected; price_selected = val1.options[val1.selectedIndex].value; if (price_selected==full_type) { alert(message_full_type); val2.focus(); val2.options.length = 1; val2.options[0].value = room_max; val2.options[0].text = ''+room_max; val2.options.selectedIndex = 0; } }