[thelist] Javascript and popup menus problems.

Emmanuel. M. Decarie emm at scriptdigital.com
Tue Jan 30 16:03:39 CST 2001


Hello I have a problemwith a Javascript function which is not working properly.

I have posted a page that will show the problem.
<http://www.scriptdigital.com/translator/>.

I have 3 popup menus called Languages, Themes, Topics.

In the Themes popup menu, I have an onChange event that call a 
function called setTopics ().

function setTopics () {

	var mainForm = document.mainForm;
	var theme = 
mainForm.popupTheme.options[mainForm.popupTheme.options.selectedIndex] 
.value;
	var popupTopicsOptions = mainForm.popupTopics.options;

	// controls
	if (theme == "0") {
		popupTopicsOptions[popupTopicsOptions.length] = new 
Option ("General Vocabulary", "1");
		popupTopicsOptions[popupTopicsOptions.length] = new 
Option ("Countries", "2");

	} else {
		popupTopicsOptions[1] = null; // get rid of this item
		popupTopicsOptions[1] = null; // index 2 is index 1 now
	}
}


What this fonction do is to add 2 new items to the Topics popup if 
the index 0 or the value "Controls" is selected in the Theme popup 
menu.

Also, when the page load, if its the index 0 that is selected in the 
Themes popup menu, the setTopics function is called.

When you press on the go button, you come back to the same page and 
the previous selection is kept.

+ The Topics popup menu work fine in the following browsers:

FreeBSD/Netscape 4.76 US
FreeBSD/Mozilla M18
Mac/Internet 5
Mac/Netscape 4.72 => display glitch in the Topics menu, the previous 
selected item is not reselected
Mac/Netscape 6.0 => display glitch, the scroll arrow not visible in 
the Topics menu
Win/Explorer 5

+ It doesn't work at all with:

Win/Netscape 4.7.8
Win/Netscape 6.0
Mac/Explorer 4.5

This page will not be public, and will be used by just a couple of 
peoples. So its ok for me if it work only with the version 4 and 5 of 
Netscape (Win and Mac) , and version 5 of Explorer (I didn't test 
with Win/IE 4x).

TIA

Cheers

-Emmanuel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Emmanuel Décarie - Consultant
   Programmation pour le Web - Programming for the Web
   UserLand Frontier  - Perl - JavaScript - AppleScript - HTML - XML
   http://www.scriptdigital.com

---> The Frontier Newbie Toolbox:
   <http://www.scriptdigital.com/fnt/frontierNewbieToolbox.html>





More information about the thelist mailing list