This is a piece of a javascript code for an HTML form. I want to be more efficient with code and not to repeat the same line more than once, is this possible in the code below?
function resetOptions(location)
{
if (location=='country')
{
removeOptions(selected_address_zone)
removeOptions(selected_address_region)
removeOptions(selected_address_city)
removeOptions(selected_address_area)
}
else if (location=='zone')
{
removeOptions(selected_address_region)
removeOptions(selected_address_city)
removeOptions(selected_address_area)
}
else if (location=='region')
{
removeOptions(selected_address_city)
removeOptions(selected_address_area)
}
else
{
removeOptions(selected_address_area)
}
}
Aucun commentaire:
Enregistrer un commentaire