TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mohan raj
NA
57
11.7k
i have drop down dependancy for contry
Jul 9 2013 10:48 AM
i have drop down dependancy for contry ,state and city
i want to update thouse detail means it's show the first array value it not show the database value
This is my javascript code
var states = new Array();
states['United States'] = new Array('Alabama', 'Alaska', 'Arizona');
states['India'] = new Array('Andhra Pradesh', 'Arunachal Pradesh', 'Assam');
var cities = new Array();
cities['United States'] = new Array();
cities['United States']['Alabama'] = new Array('Birmingham', 'Montgomery', 'Mobile', 'Huntsville');
cities['United States']['Alaska'] = new Array('Tucson', 'Anchorage');
cities['United States']['Arizona'] = new Array('Chandler', 'Phoenix', 'Mesa', 'Glendale', 'Scottsdale', 'Gilbert', 'Tempe', 'Peoria', 'Surprise');
cities['India'] = new Array();
cities['India']['Andhra Pradesh'] = new Array('Adilabad', 'Adoni', 'Amadalavalasa', 'Amalapuram', 'Ameenapuram', 'Anakapalle', 'Anantapur','Warangal', 'Yellandu', 'Yemmiganur', 'Yerraguntla', 'Zahirabad');
cities['India']['Arunachal Pradesh'] = new Array('Along', 'Bomdila', 'Itanagar*', 'Naharlagun', 'Pasighat');
cities['India']['Assam'] = new Array('Abhayapuri', 'Amguri', 'Anandnagaar', 'Barpeta', 'Barpeta Road', 'Bilasipara','Nalbari', 'North Lakhimpur', 'Rangia', 'Sibsagar', 'Silapathar', 'Silchar', 'Tezpur', 'Tinsukia');
function setStates() {
cntrySel = document.getElementById('ddlCountry');
stateList = states[cntrySel.value];
changeSelect('ddlState', stateList, stateList);
setCities();
}
function setCities() {
cntrySel = document.getElementById('ddlCountry');
stateSel = document.getElementById('ddlState');
cityList = cities[cntrySel.value][stateSel.value];
changeSelect('ddlCity', cityList, cityList);
}
function changeSelect(fieldID, newOptions, newValues) {
selectField.options.length = 0;
for (i = 0; i < newOptions.length; i++) {
selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function () {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function () {
setStates();
});
Reply
Answers (
21
)
static class members should call with class name...
GAC