View Full Version : JS Combo box filtering? One box filters two

06-10-2008, 05:29 AM
Im making a web form, where the user will select which continent there on. That will then 'unhide' a drop box with a list of Country Codes found in that continent. At the same time, it will also 'unhide' a drop box with a list of Time Zones found in that continent.

I can get it to load one drop box, but not two based off the first boxes selection.

Honestly, I rather hand code 3 large arrays in JS over just using ajax and php/mysql. Reason is, iv already hand coded rather large arrays as it is, and the work put into those , i dont want to loose. Also I have all the information needed inside excel, and I can use functions to help print the array for me.

North America
Canada - United States - Mexico
(us) Eastern - Central - Mountain - Pacific

06-11-2008, 12:57 AM
Never mind I got something

<a href="javascript:dubload(raycountry,'countrycodes',combo2,'timezones')">North America</a> |
<a href="javascript:dubload(ray2country,'countrycodes',combo4,'timezones')">Europe</a>
<form name="combo">
<select name="countrycodes">
<option value="#">--loading--</option>
</select><br /><br />
<select name="timezones">
<option value="#">--loading--</option>
var raycountry=new Array()
raycountry[0]=new Option("United States","1")
raycountry[1]=new Option("Canada","1")
raycountry[2]=new Option("Mexico","1")
raycountry[3]=new Option("Japan","15")
raycountry[4]=new Option("China","55")
var combo2=new Array()
combo2[0]=new Option("EST","utc")
combo2[1]=new Option("CST","utc")
combo2[2]=new Option("MST","utc")
combo2[3]=new Option("PST","utc")
var ray2country=new Array()
ray2country[0]=new Option("Canada","1")
ray2country[1]=new Option("Mexico","1")
ray2country[2]=new Option("United States","1")
ray2country[3]=new Option("Japan","15")
ray2country[4]=new Option("China","55")
var combo4=new Array()
combo4[0]=new Option("CST","utc")
combo4[1]=new Option("MST","utc")
combo4[2]=new Option("EST","utc")
combo4[3]=new Option("PST","utc")
function populate(x,box){
var cacheobj=document.getElementById(box)
for (m=cacheobj.options.length-1;m>0;m--)
for (i=0;i<selectedarray.length;i++)
cacheobj.options[i]=new Option(selectedarray[i].text,selectedarray[i].value)
function dubload(x,box,t,bird) {

06-11-2008, 02:39 PM
Why dont this work in on the Mac :(