The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
Please help with this Javascript
Discuss Please help with this Javascript in the JavaScript Development forum on Dev Shed. Please help with this Javascript JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

September 6th, 2001, 09:33 AM
|
|
Contributing User
|
|
Join Date: Jun 2001
Location: Chicago, IL
Posts: 85
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
Please help with this Javascript
I am having trouble getting this script to reset. This script aloows the user to select a region and in turn, the countries below shift in accordance with the region they choose. The problem occurs when the make a selection and go to a new page... if they try to go back to the script, the region resets but the countries do not! I need to figure out how to get the countries to go back to their default. Can anyone help?
<!--
var regionsArray = new Array(7);
regionsArray[0] = new Array("Botswana","Ethiopa","Kenya","Madagascar","Mali","Morocco","Namibia","South Africa","Tanzania","Uganda","Zambia","Zimbabwe");
regionsArray[1] = new Array("Argentina","Belize","Bolivia","Brazil","Chile","Costa Rica","Galapagos","Panama","Peru");
regionsArray[2] = new Array("Bhutan","Burma","Cambodia","China","India","Ladakh","Laos","Multi-Country","Nepal","Thailand","Tibet","Vietnam");
regionsArray[3] = new Array("Greece","Italy","Turkey");
regionsArray[4] = new Array("Egypt","Iran","Israel","Jordan","Lebanon","Oman","Syria");
regionsArray[5] = new Array("Australia","Hawaii","Indonesia","New Zealand","Samoa");
regionsArray[6] = new Array("Antarctic","Arctic")
function updateCountries(n) {
var arr = regionsArray[n];
var current = document.forms[0].countries.options.length;
for (var j=current;j>0;j--) document.forms[0].countries.options[j] = null;
for (var i=0;i<arr.length;i++) document.forms[0].countries.options[document.forms[0].countries.options.length] = new Option(arr[i],arr[i]);
}
-->
|

September 6th, 2001, 11:19 AM
|
|
Contributing User
|
|
Join Date: Apr 2001
Location: New York
Posts: 122
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
What's the default state for the countries list?
|

September 6th, 2001, 02:50 PM
|
|
Contributing User
|
|
Join Date: Jun 2001
Location: Chicago, IL
Posts: 85
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
default
I want region to default to Africa and the countries to default to the corresponding african countries. Currently, the countries remain on the last region selected so if the user selects americas for example, then goes back, the region will be on africa but the countries will be the american countries.
|

September 6th, 2001, 03:08 PM
|
|
Junior Member
|
|
Join Date: Sep 2001
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
how about putting
onLoad("updateCountries(0);")
in the body tag?
Last edited by gchip : September 6th, 2001 at 03:29 PM.
|

November 2nd, 2001, 02:03 PM
|
|
Contributing User
|
|
Join Date: Jun 2001
Location: Chicago, IL
Posts: 85
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
That didn't help. Any more clues?
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|