Jumpy09 Posted August 21, 2011 Share Posted August 21, 2011 Alright I am doing a project and I have ran into a particular issue with Firefox not wanting to properly work this particular bit of the script! I am populating a second select menu depending on the selected value of the first select menu. var yearselect = document.getElementById("schoolyear"); var year = yearselect.options[yearselect.selectedIndex].value; var newselect = document.getElementById("coursecode"); var a; for ( a = newselect.length - 1; a >= 0; a-- ) { newselect.remove(a); } if ( year == 100 ) { var course = new Array(); course [0] = "Literature" ; course [1] = "Foreign Literature" ; var code; for (var i = 0; i < course.length; ++i ) { code = "10" + i ; newselect.add(code, course[i]); newselect.options[newselect.options.length] = new Option(course[i], code, false, false); } } I have it set to do the function onblur, which works perfectly changing through the first menu for all of them in Chrome. Unfortunately Firefox doesn't want to put the data in when I go back to the first option in the first menu from any other option. It will render it correctly for the 2nd, 3rd, and 4th options, but the second select menu is blank when I click off of the first menu using the first option. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/245392-javascript-chrome-vs-firefox/ Share on other sites More sharing options...
Jumpy09 Posted August 22, 2011 Author Share Posted August 22, 2011 I had taken newselect.add(code, course[i]); out of the rest of the code, and it kind of camouflaged itself. Still strange why it was working on Chrome and not Firefox, but nevertheless SOLVED! Quote Link to comment https://forums.phpfreaks.com/topic/245392-javascript-chrome-vs-firefox/#findComment-1260349 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.