I must do a form where I ask for the birthday, I do 3 <select> and I want that when I choose february, the 31° are not available ? How can I do that ??
i would remove the values > 29 if the month is february, add them instead. There might be a smarter solution but i don't see :-(
removing an option
the_name_of_your_lisbox.options.remove(the_index_of_the_item_you_wish_to_remove);
adding an option
var oOption = document.createElement("OPTION"
oOption.text=the_text_of_the_item_you_want_to_add;
oOption.value=the_value(index)_of_the_item_you_want_to_add;
the_name_of_your_lisbox.options.add(oOption)
You could have an array which holds the number of days for each month, where the index will correspond to the month:
daysArray[0]= days in January etc...
onChange in the month select box add some script which just takes the selected index from the month, and applies it to your array, returning the number of days.You can for loop it put all the values in for you.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.