Hi,
I have a function here:
This is part of a Ajax drop down menu for region and town, i want to mod this so that it can work on three different fields as i have three selections for region and town.
I thought this would work but it doesn't.
On the drop down itself i have put:
Any ideas?
I have a function here:
Code:
var AdminResponse = "";
function parseResponse(){
var nText = AdminResponse.getElementsByTagName('optionText');
var nVal = AdminResponse.getElementsByTagName('optionVal');
document.forms["area"].elements['town'].options.length = 1;
for (i=0; i<nText.length; i++)
{
var nOption = document.createElement('option');
var isText = document.createTextNode(nText[i].firstChild.data);
nOption.setAttribute('value',nVal[i].firstChild.data);
nOption.appendChild(isText);
document.forms["area"]['town'].appendChild(nOption);
}
}
I thought this would work but it doesn't.
Code:
var AdminResponse = "";
function parseResponse(field){
var nText = AdminResponse.getElementsByTagName('optionText');
var nVal = AdminResponse.getElementsByTagName('optionVal');
document.forms["area"].elements['field'].options.length = 1;
for (i=0; i<nText.length; i++)
{
var nOption = document.createElement('option');
var isText = document.createTextNode(nText[i].firstChild.data);
nOption.setAttribute('value',nVal[i].firstChild.data);
nOption.appendChild(isText);
document.forms["area"]['field'].appendChild(nOption);
}
}
Code:
onchange="update(this.value,'town')"
Comment