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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.