HI. I have a dropdown menu named arrivalcity (options are Rome, Naples, Palermo, and CAtania).
I also have 4 other dropdown menus which have departure dates for those cities.
Basically I want those 4 dropdown menus disabled by default. Then based on which arrivalcity
option they choose only one of those 4 dropdown menus gets enabled so they can select the departure date from the appropriate menu.
I know this can get accomplished in javascript, but I don't know where to start. Please help. I'm getting desperate to accomplish this.
The following is what I have so far:
Any help would greatly be appreciated. Thanks!
I also have 4 other dropdown menus which have departure dates for those cities.
Basically I want those 4 dropdown menus disabled by default. Then based on which arrivalcity
option they choose only one of those 4 dropdown menus gets enabled so they can select the departure date from the appropriate menu.
I know this can get accomplished in javascript, but I don't know where to start. Please help. I'm getting desperate to accomplish this.
The following is what I have so far:
Code:
<script type="text/javascript">
function selChk(obj)
{
var rome_dep = document.getElementById('arrivaldate_rome');
var naples_dep = document.getElementById('arrivaldate_rome');
var palermo_dep = document.getElementById('arrivaldate_rome');
var catania_dep = document.getElementById('arrivaldate_rome');
if(obj.value!= 'nose1')
{
if (obj.value = 'rome')
{
rome_dep.disabled = false;
naples_dep.disabled = true;
palermo_dep.disabled = true;
catania_dep.disabled = true;
}
else if (obj.value = 'naples')
{
rome_dep.disabled = true;
naples_dep.disabled = false;
palermo_dep.disabled = true;
catania_dep.disabled = true;
}
else if (obj.value = 'palermo')
{
rome_dep.disabled = true;
naples_dep.disabled = true;
palermo_dep.disabled = false;
catania_dep.disabled = true;
}
else
{
rome_dep.disabled = true;
naples_dep.disabled = true;
palermo_dep.disabled = true;
catania_dep.disabled = false;
}
else
{
rome_dep.disabled = true;
naples_dep.disabled = true;
palermo_dep.disabled = true;
catania_dep.disabled = true;
}
}
</script>
<html>
<body>
<select name="arrivalcity" size="1" id="arrivalcity" maxlength="25" ononchange="selChk(this);">
<option value="nose1">please select</option>
please select
<option value="Rome">Rome</option>
<option value="Naples">Naples</option>
<option value="Palermo">Palermo</option>
<option value="Catania">Catania</option>
<option value="Other">Other</option>
</select>
</body>
</html>
Comment