#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Chicago, IL
    Posts
    85
    Rep Power
    14

    Exclamation Please help with this JavaScript


    Ahhhh! I can't get this to work! It was functioning just fine yesterday but now it won't do anything for me. I want the countries to change depending on which region is selected. No matter what region I select, the countries don't change. Always africa countries. Please help!

    This is the URL: http://www.journeys-intl.com/trip_search.html


    JavaScript:

    var regionsArray = new Array(7);
    regionsArray[0] = new Array("Botswana","Ethiopa","Kenya","Kilimanjaro","Madagascar","Mali","Morocco","Namibia","South Africa","Tanzania","Uganda","Zambia","Zimbabwe");
    regionsArray[1] = new Array("Argentina","Belize","Bolivia","Brazil","Chile","Costa Rica","Galapagos","Guatamala","Panama","Peru");
    regionsArray[2] = new Array("Bhutan","Burma","Cambodia","Central Asia","China","India","Ladakh","Laos","Mongolia","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","Japan","New Zealand","Papa N.Guinea","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]);
    }

    HTML:

    <div align="center"><center><p><font face="Arial" size="2"><strong>Region:</strong><br>
    <select name="region" onchange="updateCountries(this.selectedIndex)" size="1">
    <option selected value="africa">Africa</option>
    <option value="Americas">Americas </option>
    <option value="Asia">Asia </option>
    <option value="Europe">Europe </option>
    <option value="Middle East">Middle East </option>
    <option value="Pacific">Pacific </option>
    <option value="Polar">Polar </option>
    </select><br>
    <strong>Country:</strong></font><br>
    <select name="countries" size="1">
    <option selected value="all">All Countries</option>
    <option value="Botswana">Botswana </option>
    <option value="Ethiopia">Ethiopia </option>
    <option value="Kenya">Kenya </option>
    <option value="Madagascar">Madagascar </option>
    <option value="mali">Mali </option>
    <option value="Morocco">Morocco </option>
    <option value="Namibia">Namibia </option>
    <option value="South africa">South Africa </option>
    <option value="Tanzania">Tanzania </option>
    <option value="Uganda">Uganda </option>
    <option value="Zambia">Zambia </option>
    <option value="Zimbabwe">Zimbabwe </option>
    </select></p>
    Last edited by Ides; October 10th, 2001 at 06:37 PM.
  2. #2
  3. Corporate Stooge
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Aberdeen, Scotland
    Posts
    134
    Rep Power
    14
    You have a "selected" in the Arican option.

    Try removing that.

    Am I being silly or have I missed the point?

    Dave
    Never sign your code....it leaves you liable!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Chicago, IL
    Posts
    85
    Rep Power
    14

IMN logo majestic logo threadwatch logo seochat tools logo