Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PepperPepsi's 3D array

Status
Not open for further replies.

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(&quot;Chinese Cuisine&quot;,&quot;a-00001&quot;)
DELIVERY = new Array(&quot;Delivery Food&quot;,&quot;b-00001&quot;)
DINER = new Array(&quot;Diners&quot;,&quot;c-00001&quot;)
FRENCH = new Array(&quot;French Cuisine&quot;,&quot;d-00001&quot;)
GREEK = new Array(&quot;Greek Cuisine&quot;,&quot;e-00001&quot;)
ITALIAN = new Array(&quot;Italian Cuisine&quot;,&quot;f-00001&quot;)
MEXICAN = new Array(&quot;Mexican Cuisine&quot;,&quot;g-00001&quot;)
MIDDLEEASTERN = new Array(&quot;Middleastern Cuisine&quot;,&quot;h-
00001&quot;)
SEAFOOD = new Array(&quot;Seafood&quot;,&quot;i-00001&quot;)
GALLERIES = new Array(&quot;Galleries&quot;,&quot;a-00002&quot;)
MOVIES = new Array(&quot;Movies&quot;,&quot;b-00002&quot;)
MUSEUMS = new Array(&quot;Museums & Exhibits&quot;,&quot;c-00002&quot;)
SPECIAL = new Array(&quot;Special Occasions&quot;,&quot;d-00002&quot;)
THEATRE = new Array(&quot;Theatre&quot;,&quot;e-00002&quot;)
BARS = new Array(&quot;Bars & Pubs&quot;,&quot;a-00003&quot;)
CLUBS = new Array(&quot;Dance & Night Clubs&quot;,&quot;b-00003&quot;)
GENERAL = new Array(&quot;General Shopping&quot;,&quot;a-10001&quot;)
WOMENS = new Array(&quot;Women's Fashion&quot;,&quot;b-10001&quot;)
MENS = new Array(&quot;Men's Fashion&quot;,&quot;c-10001&quot;)
SPORTSSHOPPING = new Array(&quot;Sports Apparel&quot;,&quot;d-
10001&quot;)
COMMERCIAL = new Array(&quot;Commercial Real Estate&quot;,&quot;a-
10002&quot;)
RESIDENTIAL = new Array(&quot;Residential Real
Estate&quot;,&quot;b-10002&quot;)
GOLFING2 = new Array(&quot;Area Golf Courses&quot;,&quot;a-20001&quot;)
BEACHES2 = new Array(&quot;Local Beaches&quot;,&quot;a-20002&quot;)
CHARTER_FISHING = new Array(&quot;Charter Fishing&quot;,&quot;a-
20003&quot;)
PARASAILING = new Array(&quot;Parasailing&quot;,&quot;b-20003&quot;)
RENTALS = new Array(&quot;Marine Rentals&quot;,&quot;c-20003&quot;)
TOURS = new Array(&quot;Tours&quot;,&quot;a-20004&quot;)
ESTUARIES = new Array(&quot;Estuaries&quot;,&quot;b-20004&quot;)
GYMS2 = new Array(&quot;Gyms & Workout Facilities&quot;,&quot;a-
20005&quot;)
AFFORDABLE = new Array(&quot;Affordable Car Rentals&quot;,&quot;a-
30001&quot;)
LUXURY = new Array(&quot;Luxury Car Rentals&quot;,&quot;b-30001&quot;)
TAXIS2 = new Array(&quot;Taxi Services&quot;,&quot;a-30002&quot;)
LIMOS2 = new Array(&quot;Limousine Services&quot;,&quot;a-30003&quot;)
HISTORICAL2 = new Array(&quot;Historical Sites &
Landmarks&quot;,&quot;a-40001&quot;)
DAYCARE = new Array(&quot;Child Day Care&quot;,&quot;a-40002&quot;)
AMUSEMENT = new Array(&quot;Amusement Parks, etc.&quot;,&quot;b-
40002&quot;)
CHRISTIAN = new Array(&quot;Christian&quot;,&quot;a-40003&quot;)
JEWISH = new Array(&quot;Jewish&quot;,&quot;b-40003&quot;)
ISLAM = new Array(&quot;Islam&quot;,&quot;c-40003&quot;)
OTHER = new Array(&quot;Other&quot;,&quot;d-40003&quot;)

DININGOUT = new Array(&quot;Dining
Out&quot;,CHINESE,DELIVERY,DINER,FRENCH,GREEK,ITALIAN,MEXICAN,MID
DLEEASTERN,SEAFOOD)
ENTERTAINMENT = new Array(&quot;Entertainment &
Arts&quot;,MOVIES,THEATRE,MUSEUMS,SPECIAL,GALLERIES)
LATENIGHT = new Array(&quot;Late Night
Activities&quot;,BARS,CLUBS)
SHOPPING = new Array
(&quot;Shopping&quot;,GENERAL,WOMENS,MENS,SPORTSSHOPPING)
REALESTATE = new Array(&quot;Local Real
Estate&quot;,COMMERCIAL,RESIDENTIAL)
GOLFING = new Array(&quot;Golfing&quot;,GOLFING2)
BEACHES = new Array(&quot;Beaches&quot;,BEACHES2)
MARINE = new Array(&quot;Marine
Activities&quot;,CHARTER_FISHING,PARASAILING,RENTALS)
OUTDOORS = new Array(&quot;Outdoors
Adventure&quot;,TOURS,ESTUARIES)
GYMS = new Array(&quot;Gyms & Workout Facilities&quot;,GYMS2)
CARS = new Array(&quot;Car Rentals&quot;,AFFORDABLE,LUXURY)
TAXIS = new Array(&quot;Taxi Companies&quot;,TAXI2)
LIMOS = new Array(&quot;Limosusine Services&quot;,LIMOS2)
HISTORICAL = new Array(&quot;Historical Sites &
Landmarks&quot;,HISTORICAL2)
CHILDREN = new Array(&quot;Children's
Activities&quot;,DAYCARE,AMUSEMENT)
RELIGIOUS = new Array(&quot;Religious Activities &
Spiritual Organizations&quot;,CHRISTIAN,JEWISH,ISLAM,OTHER)
Place = new Array
(&quot;&quot;,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=&quot;place&quot;>
<select name=&quot;region&quot; onchange=&quot;changeRegion()&quot;>
<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=&quot;countries&quot; onchange=&quot;changeCountries
()&quot;>
<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=&quot;cities&quot;>
<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(&quot;USA&quot;,&quot;NEW YORK&quot;,&quot;WASHINGTON&quot;,&quot;BOSTON&quot;)
CANADA = new Array(&quot;Canada&quot;,&quot;Toronto&quot;,&quot;Vancouver&quot;,&quot;Quebec&quot;)
CHINA = new Array(&quot;China&quot;,&quot;Beijing&quot;,&quot;Canton&quot;,&quot;Shanghai&quot;)
HONGKONG = new Array(&quot;Hong Kong&quot;,&quot;HongKong Island&quot;,&quot;TaiKoo&quot;,&quot;Kowloon&quot;)

NORTH_AMERICA = new Array(&quot;North America&quot;,USA,CANADA)
ASIA = new Array(&quot;Asia&quot;,CHINA,HONGKONG)
Place = new Array(&quot;&quot;,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=&quot;place&quot;>
<select name=&quot;region&quot; onchange=&quot;changeRegion()&quot;>
<option>North America</option>
<option>ASIA</option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name=&quot;countries&quot; onchange=&quot;changeCountries
()&quot;>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
<br>
<select name=&quot;cities&quot;>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</form>
</body>
</html>

 
Hi,

In your code line 56, it should be
TAXIS = new Array(&quot;Taxi Companies&quot;,TAXIS2)
not
TAXIS = new Array(&quot;Taxi Companies&quot;,TAXI2)

and thanks for using my code, but i did that in hurry, so i hope it won't have too many bugs =)

Chiu Chan
cchan@emagine-solutions.com
 
PepperPepsi,

I think that the code if great - however, that didn't correct the problem. - Here is a link to the page - any more suggestions would be great - I'm pulling my hair out!


Thanks

nathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top