ki Posted April 18, 2007 Share Posted April 18, 2007 okay what im trying to do is make it so when a person selects a month it will set the other dropdown box to exactly the number of days in the month I got most of what it is but when i add new stuff to it, it just adds on, and i tried adding options.length = 0; to it at the begging of the function and it works in FF and runs the script just fine but when i run it in ie7 it just clears the whole list and doesnt add anything. please tell me what you think is happening heres the code: function changeRegisterBirthday() { document.getElementById('register_BirthdayDay').options.length = 0; if ( (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "6") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "9") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "4") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "11")) { for (var i=1; i <= 30; i++) { document.getElementById('register_BirthdayDay').options[document.getElementById('register_BirthdayDay').options.length] = new Option(i, i); document.getElementById('register_BirthdayDay').selectedIndex = 0; } } if ( (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "1") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "3") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "5") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "7") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "12") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "10") || (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "8")) { for (var i=1; i <= 31; i++) { document.getElementById('register_BirthdayDay').options[document.getElementById('register_BirthdayDay').options.length] = new Option(i, i); document.getElementById('register_BirthdayDay').selectedIndex = 0; } } if (register_BirthdayMonth.options[register_BirthdayMonth.selectedIndex].value == "2") { for (var i=1; i <= 28; i++) { document.getElementById('register_BirthdayDay').options[document.getElementById('register_BirthdayDay').options.length] = new Option(i, i); document.getElementById('register_BirthdayDay').selectedIndex = 0; } } } Link to comment https://forums.phpfreaks.com/topic/47481-help-with-function/ Share on other sites More sharing options...
fenway Posted April 20, 2007 Share Posted April 20, 2007 I'm very confused... why are you adding options? Link to comment https://forums.phpfreaks.com/topic/47481-help-with-function/#findComment-233906 Share on other sites More sharing options...
ki Posted April 20, 2007 Author Share Posted April 20, 2007 nah i got it already, i was adding options because i wanted the exact number of days in each month for my registration script Link to comment https://forums.phpfreaks.com/topic/47481-help-with-function/#findComment-234142 Share on other sites More sharing options...
fenway Posted April 20, 2007 Share Posted April 20, 2007 How was it solved? Link to comment https://forums.phpfreaks.com/topic/47481-help-with-function/#findComment-234198 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.