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; } } } Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted April 20, 2007 Share Posted April 20, 2007 How was it solved? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.