Jump to content

Javascript Chrome vs Firefox!


Jumpy09

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/245392-javascript-chrome-vs-firefox/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.