Guest_imported
New member
- Jan 1, 1970
- 0
A few days ago there was a question about a 3d array. Pepper Pepsi posted a sample array. I'm trying to implement it - however, I'm having real problems. I've gone over and over the syntax structure, and it exactly matches Pepper's. Can I get a fresh set of eyeballs - please.
Below I've pasted my code, and then below that PepperPepsi's. I'm sure it's someting iditoically easy - oh well, I never said I wasn't an idiot. Thanks a bunch (and thanks PepperPepsi for the great code!)
<html>
<head>
<script>
CHINESE = new Array("Chinese Cuisine","a-00001"
DELIVERY = new Array("Delivery Food","b-00001"
DINER = new Array("Diners","c-00001"
FRENCH = new Array("French Cuisine","d-00001"
GREEK = new Array("Greek Cuisine","e-00001"
ITALIAN = new Array("Italian Cuisine","f-00001"
MEXICAN = new Array("Mexican Cuisine","g-00001"
MIDDLEEASTERN = new Array("Middleastern Cuisine","h-
00001"
SEAFOOD = new Array("Seafood","i-00001"
GALLERIES = new Array("Galleries","a-00002"
MOVIES = new Array("Movies","b-00002"
MUSEUMS = new Array("Museums & Exhibits","c-00002"
SPECIAL = new Array("Special Occasions","d-00002"
THEATRE = new Array("Theatre","e-00002"
BARS = new Array("Bars & Pubs","a-00003"
CLUBS = new Array("Dance & Night Clubs","b-00003"
GENERAL = new Array("General Shopping","a-10001"
WOMENS = new Array("Women's Fashion","b-10001"
MENS = new Array("Men's Fashion","c-10001"
SPORTSSHOPPING = new Array("Sports Apparel","d-
10001"
COMMERCIAL = new Array("Commercial Real Estate","a-
10002"
RESIDENTIAL = new Array("Residential Real
Estate","b-10002"
GOLFING2 = new Array("Area Golf Courses","a-20001"
BEACHES2 = new Array("Local Beaches","a-20002"
CHARTER_FISHING = new Array("Charter Fishing","a-
20003"
PARASAILING = new Array("Parasailing","b-20003"
RENTALS = new Array("Marine Rentals","c-20003"
TOURS = new Array("Tours","a-20004"
ESTUARIES = new Array("Estuaries","b-20004"
GYMS2 = new Array("Gyms & Workout Facilities","a-
20005"
AFFORDABLE = new Array("Affordable Car Rentals","a-
30001"
LUXURY = new Array("Luxury Car Rentals","b-30001"
TAXIS2 = new Array("Taxi Services","a-30002"
LIMOS2 = new Array("Limousine Services","a-30003"
HISTORICAL2 = new Array("Historical Sites &
Landmarks","a-40001"
DAYCARE = new Array("Child Day Care","a-40002"
AMUSEMENT = new Array("Amusement Parks, etc.","b-
40002"
CHRISTIAN = new Array("Christian","a-40003"
JEWISH = new Array("Jewish","b-40003"
ISLAM = new Array("Islam","c-40003"
OTHER = new Array("Other","d-40003"
DININGOUT = new Array("Dining
Out",CHINESE,DELIVERY,DINER,FRENCH,GREEK,ITALIAN,MEXICAN,MID
DLEEASTERN,SEAFOOD)
ENTERTAINMENT = new Array("Entertainment &
Arts",MOVIES,THEATRE,MUSEUMS,SPECIAL,GALLERIES)
LATENIGHT = new Array("Late Night
Activities",BARS,CLUBS)
SHOPPING = new Array
("Shopping",GENERAL,WOMENS,MENS,SPORTSSHOPPING)
REALESTATE = new Array("Local Real
Estate",COMMERCIAL,RESIDENTIAL)
GOLFING = new Array("Golfing",GOLFING2)
BEACHES = new Array("Beaches",BEACHES2)
MARINE = new Array("Marine
Activities",CHARTER_FISHING,PARASAILING,RENTALS)
OUTDOORS = new Array("Outdoors
Adventure",TOURS,ESTUARIES)
GYMS = new Array("Gyms & Workout Facilities",GYMS2)
CARS = new Array("Car Rentals",AFFORDABLE,LUXURY)
TAXIS = new Array("Taxi Companies",TAXI2)
LIMOS = new Array("Limosusine Services",LIMOS2)
HISTORICAL = new Array("Historical Sites &
Landmarks",HISTORICAL2)
CHILDREN = new Array("Children's
Activities",DAYCARE,AMUSEMENT)
RELIGIOUS = new Array("Religious Activities &
Spiritual Organizations",CHRISTIAN,JEWISH,ISLAM,OTHER)
Place = new Array
("",DININGOUT,ENTERTAINMENT,LATENIGHT,SHOPPING,REALESTATE,GO
LFING,BEACHES,MARINE,OUTDOORS,GYMS,CARS,TAXIS,LIMOS,HISTORIC
AL,CHILDREN,RELIGIOUS)
DININGOUT_ID = new Array(CHINESE[0],DELIVERY
[0],DINER[0],FRENCH[0],GREEK[0],ITALIAN[0],MEXICAN
[0],MIDDLEEASTERN[0],SEAFOOD[0])
ENTERTAINMENT_ID = new Array(MOVIES[0],THEATRE
[0],MUSEUMS[0],SPECIAL[0],GALLERIES[0])
LATENIGHT_ID = new Array(BARS[0],CLUBS[0])
SHOPPING_ID = new Array(GENERAL[0],WOMENS[0],MENS
[0],SPORTSSHOPPING[0])
REALESTATE_ID = new Array(COMMERCIAL[0],RESIDENTIAL
[0])
GOLFING_ID = new Array(GOLFING2[0])
BEACHES_ID = new Array(BEACHES2[0])
MARINE_ID = new Array(CHARTER_FISHING[0],PARASAILING
[0],RENTALS[0])
OUTDOORS_ID = new Array(TOURS[0],ESTUARIES[0])
GYMS_ID = new Array(GYMS2[0])
CARS_ID = new Array(AFFORDABLE[0],LUXURY[0])
TAXIS_ID = new Array(TAXI2[0])
LIMOS_ID = new Array(LIMOS2[0])
HISTORICAL_ID = new Array(HISTORICAL2[0])
CHILDREN_ID = new Array(DAYCARE,AMUSEMENT[0])
RELIGIOUS_ID = new Array(CHRISTIAN[0],JEWISH
[0],ISLAM[0],OTHER[0])
PLACE_ID = new Array
(DININGOUT_ID,ENTERTAINMENT_ID,LATENIGHT_ID,SHOPPING_ID,REAL
ESTATE_ID,GOLFING_ID,BEACHES_ID,MARINE_ID,OUTDOORS_ID,GYMS_I
D,CARS_ID,TAXIS_ID,LIMOS_ID,HISTORICAL_ID,CHILDREN_ID,RELIGI
OUS_ID)
function changeRegion() {
selected_region =
document.place.region.selectedIndex + 1
selected_countries =
document.place.countries.selectedIndex + 1
num_countries = Place[selected_region].length-1
num_cities = Place[selected_region]
[selected_countries].length-1
for (i=0; i<num_countries; i++) {
document.place.countries.options.text =
PLACE_ID[selected_region-1]
}
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text =
Place[selected_region][selected_countries][j+1]
}
}
function changeCountries() {
selected_region =
document.place.region.selectedIndex + 1
selected_countries =
document.place.countries.selectedIndex + 1
num_cities = Place[selected_region]
[selected_countries].length-1
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text =
Place[selected_region][selected_countries][j+1]
}
}
</script>
</head>
<body>
<form name="place">
<select name="region" onchange="changeRegion()">
<option>Dining Out</option>
<option>Entertainment & Arts</option>
<option>Late Night Activities</option>
<option>Shopping</option>
<option>Local Real Estate</option>
<option>Golfing</option>
<option>Beaches</option>
<option>Marine Activities</option>
<option>Outdoors Adventure</option>
<option>Gyms & Workout Facilities</option>
<option>Car Rentals</option>
<option>Taxi Companies</option>
<option>Limosusine Services</option>
<option>Historical Sites &
Landmarks</option>
<option>Children's Activities</option>
<option>Religious Activities & Spiritual
Organizations</option>
</select>
<br>
<select name="countries" onchange="changeCountries
()">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name="cities">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</form>
</body>
</html>
------------------------------PepperPepsi's Code---------
<head>
<script>
USA = new Array("USA","NEW YORK","WASHINGTON","BOSTON"
CANADA = new Array("Canada","Toronto","Vancouver","Quebec"
CHINA = new Array("China","Beijing","Canton","Shanghai"
HONGKONG = new Array("Hong Kong","HongKong Island","TaiKoo","Kowloon"
NORTH_AMERICA = new Array("North America",USA,CANADA)
ASIA = new Array("Asia",CHINA,HONGKONG)
Place = new Array("",NORTH_AMERICA,ASIA)
NORTH_AMERICA_ID = new Array(USA[0],CANADA[0])
ASIA_ID = new Array(CHINA[0],HONGKONG[0])
PLACE_ID = new Array(NORTH_AMERICA_ID,ASIA_ID)
function changeRegion() {
selected_region = document.place.region.selectedIndex + 1
selected_countries = document.place.countries.selectedIndex + 1
num_countries = Place[selected_region].length-1
num_cities = Place[selected_region]
[selected_countries].length-1
for (i=0; i<num_countries; i++) {
document.place.countries.options.text =
PLACE_ID[selected_region-1]
}
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text = Place[selected_region][selected_countries][j+1]
}
}
function changeCountries() {
selected_region = document.place.region.selectedIndex + 1
selected_countries = document.place.countries.selectedIndex + 1
num_cities = Place[selected_region][selected_countries].length-1
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text =
Place[selected_region][selected_countries][j+1]
}
}
</script>
</head>
<body>
<form name="place">
<select name="region" onchange="changeRegion()">
<option>North America</option>
<option>ASIA</option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name="countries" onchange="changeCountries
()">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name="cities">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</form>
</body>
</html>
Below I've pasted my code, and then below that PepperPepsi's. I'm sure it's someting iditoically easy - oh well, I never said I wasn't an idiot. Thanks a bunch (and thanks PepperPepsi for the great code!)
<html>
<head>
<script>
CHINESE = new Array("Chinese Cuisine","a-00001"
DELIVERY = new Array("Delivery Food","b-00001"
DINER = new Array("Diners","c-00001"
FRENCH = new Array("French Cuisine","d-00001"
GREEK = new Array("Greek Cuisine","e-00001"
ITALIAN = new Array("Italian Cuisine","f-00001"
MEXICAN = new Array("Mexican Cuisine","g-00001"
MIDDLEEASTERN = new Array("Middleastern Cuisine","h-
00001"
SEAFOOD = new Array("Seafood","i-00001"
GALLERIES = new Array("Galleries","a-00002"
MOVIES = new Array("Movies","b-00002"
MUSEUMS = new Array("Museums & Exhibits","c-00002"
SPECIAL = new Array("Special Occasions","d-00002"
THEATRE = new Array("Theatre","e-00002"
BARS = new Array("Bars & Pubs","a-00003"
CLUBS = new Array("Dance & Night Clubs","b-00003"
GENERAL = new Array("General Shopping","a-10001"
WOMENS = new Array("Women's Fashion","b-10001"
MENS = new Array("Men's Fashion","c-10001"
SPORTSSHOPPING = new Array("Sports Apparel","d-
10001"
COMMERCIAL = new Array("Commercial Real Estate","a-
10002"
RESIDENTIAL = new Array("Residential Real
Estate","b-10002"
GOLFING2 = new Array("Area Golf Courses","a-20001"
BEACHES2 = new Array("Local Beaches","a-20002"
CHARTER_FISHING = new Array("Charter Fishing","a-
20003"
PARASAILING = new Array("Parasailing","b-20003"
RENTALS = new Array("Marine Rentals","c-20003"
TOURS = new Array("Tours","a-20004"
ESTUARIES = new Array("Estuaries","b-20004"
GYMS2 = new Array("Gyms & Workout Facilities","a-
20005"
AFFORDABLE = new Array("Affordable Car Rentals","a-
30001"
LUXURY = new Array("Luxury Car Rentals","b-30001"
TAXIS2 = new Array("Taxi Services","a-30002"
LIMOS2 = new Array("Limousine Services","a-30003"
HISTORICAL2 = new Array("Historical Sites &
Landmarks","a-40001"
DAYCARE = new Array("Child Day Care","a-40002"
AMUSEMENT = new Array("Amusement Parks, etc.","b-
40002"
CHRISTIAN = new Array("Christian","a-40003"
JEWISH = new Array("Jewish","b-40003"
ISLAM = new Array("Islam","c-40003"
OTHER = new Array("Other","d-40003"
DININGOUT = new Array("Dining
Out",CHINESE,DELIVERY,DINER,FRENCH,GREEK,ITALIAN,MEXICAN,MID
DLEEASTERN,SEAFOOD)
ENTERTAINMENT = new Array("Entertainment &
Arts",MOVIES,THEATRE,MUSEUMS,SPECIAL,GALLERIES)
LATENIGHT = new Array("Late Night
Activities",BARS,CLUBS)
SHOPPING = new Array
("Shopping",GENERAL,WOMENS,MENS,SPORTSSHOPPING)
REALESTATE = new Array("Local Real
Estate",COMMERCIAL,RESIDENTIAL)
GOLFING = new Array("Golfing",GOLFING2)
BEACHES = new Array("Beaches",BEACHES2)
MARINE = new Array("Marine
Activities",CHARTER_FISHING,PARASAILING,RENTALS)
OUTDOORS = new Array("Outdoors
Adventure",TOURS,ESTUARIES)
GYMS = new Array("Gyms & Workout Facilities",GYMS2)
CARS = new Array("Car Rentals",AFFORDABLE,LUXURY)
TAXIS = new Array("Taxi Companies",TAXI2)
LIMOS = new Array("Limosusine Services",LIMOS2)
HISTORICAL = new Array("Historical Sites &
Landmarks",HISTORICAL2)
CHILDREN = new Array("Children's
Activities",DAYCARE,AMUSEMENT)
RELIGIOUS = new Array("Religious Activities &
Spiritual Organizations",CHRISTIAN,JEWISH,ISLAM,OTHER)
Place = new Array
("",DININGOUT,ENTERTAINMENT,LATENIGHT,SHOPPING,REALESTATE,GO
LFING,BEACHES,MARINE,OUTDOORS,GYMS,CARS,TAXIS,LIMOS,HISTORIC
AL,CHILDREN,RELIGIOUS)
DININGOUT_ID = new Array(CHINESE[0],DELIVERY
[0],DINER[0],FRENCH[0],GREEK[0],ITALIAN[0],MEXICAN
[0],MIDDLEEASTERN[0],SEAFOOD[0])
ENTERTAINMENT_ID = new Array(MOVIES[0],THEATRE
[0],MUSEUMS[0],SPECIAL[0],GALLERIES[0])
LATENIGHT_ID = new Array(BARS[0],CLUBS[0])
SHOPPING_ID = new Array(GENERAL[0],WOMENS[0],MENS
[0],SPORTSSHOPPING[0])
REALESTATE_ID = new Array(COMMERCIAL[0],RESIDENTIAL
[0])
GOLFING_ID = new Array(GOLFING2[0])
BEACHES_ID = new Array(BEACHES2[0])
MARINE_ID = new Array(CHARTER_FISHING[0],PARASAILING
[0],RENTALS[0])
OUTDOORS_ID = new Array(TOURS[0],ESTUARIES[0])
GYMS_ID = new Array(GYMS2[0])
CARS_ID = new Array(AFFORDABLE[0],LUXURY[0])
TAXIS_ID = new Array(TAXI2[0])
LIMOS_ID = new Array(LIMOS2[0])
HISTORICAL_ID = new Array(HISTORICAL2[0])
CHILDREN_ID = new Array(DAYCARE,AMUSEMENT[0])
RELIGIOUS_ID = new Array(CHRISTIAN[0],JEWISH
[0],ISLAM[0],OTHER[0])
PLACE_ID = new Array
(DININGOUT_ID,ENTERTAINMENT_ID,LATENIGHT_ID,SHOPPING_ID,REAL
ESTATE_ID,GOLFING_ID,BEACHES_ID,MARINE_ID,OUTDOORS_ID,GYMS_I
D,CARS_ID,TAXIS_ID,LIMOS_ID,HISTORICAL_ID,CHILDREN_ID,RELIGI
OUS_ID)
function changeRegion() {
selected_region =
document.place.region.selectedIndex + 1
selected_countries =
document.place.countries.selectedIndex + 1
num_countries = Place[selected_region].length-1
num_cities = Place[selected_region]
[selected_countries].length-1
for (i=0; i<num_countries; i++) {
document.place.countries.options.text =
PLACE_ID[selected_region-1]
}
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text =
Place[selected_region][selected_countries][j+1]
}
}
function changeCountries() {
selected_region =
document.place.region.selectedIndex + 1
selected_countries =
document.place.countries.selectedIndex + 1
num_cities = Place[selected_region]
[selected_countries].length-1
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text =
Place[selected_region][selected_countries][j+1]
}
}
</script>
</head>
<body>
<form name="place">
<select name="region" onchange="changeRegion()">
<option>Dining Out</option>
<option>Entertainment & Arts</option>
<option>Late Night Activities</option>
<option>Shopping</option>
<option>Local Real Estate</option>
<option>Golfing</option>
<option>Beaches</option>
<option>Marine Activities</option>
<option>Outdoors Adventure</option>
<option>Gyms & Workout Facilities</option>
<option>Car Rentals</option>
<option>Taxi Companies</option>
<option>Limosusine Services</option>
<option>Historical Sites &
Landmarks</option>
<option>Children's Activities</option>
<option>Religious Activities & Spiritual
Organizations</option>
</select>
<br>
<select name="countries" onchange="changeCountries
()">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name="cities">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</form>
</body>
</html>
------------------------------PepperPepsi's Code---------
<head>
<script>
USA = new Array("USA","NEW YORK","WASHINGTON","BOSTON"
CANADA = new Array("Canada","Toronto","Vancouver","Quebec"
CHINA = new Array("China","Beijing","Canton","Shanghai"
HONGKONG = new Array("Hong Kong","HongKong Island","TaiKoo","Kowloon"
NORTH_AMERICA = new Array("North America",USA,CANADA)
ASIA = new Array("Asia",CHINA,HONGKONG)
Place = new Array("",NORTH_AMERICA,ASIA)
NORTH_AMERICA_ID = new Array(USA[0],CANADA[0])
ASIA_ID = new Array(CHINA[0],HONGKONG[0])
PLACE_ID = new Array(NORTH_AMERICA_ID,ASIA_ID)
function changeRegion() {
selected_region = document.place.region.selectedIndex + 1
selected_countries = document.place.countries.selectedIndex + 1
num_countries = Place[selected_region].length-1
num_cities = Place[selected_region]
[selected_countries].length-1
for (i=0; i<num_countries; i++) {
document.place.countries.options.text =
PLACE_ID[selected_region-1]
}
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text = Place[selected_region][selected_countries][j+1]
}
}
function changeCountries() {
selected_region = document.place.region.selectedIndex + 1
selected_countries = document.place.countries.selectedIndex + 1
num_cities = Place[selected_region][selected_countries].length-1
for (j=0; j<num_cities; j++) {
document.place.cities.options[j].text =
Place[selected_region][selected_countries][j+1]
}
}
</script>
</head>
<body>
<form name="place">
<select name="region" onchange="changeRegion()">
<option>North America</option>
<option>ASIA</option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name="countries" onchange="changeCountries
()">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name="cities">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</form>
</body>
</html>