Hi,
I am using the following function to do a country/region ajax drop down list.
This will bring a list of regions based on what country is selected, what i need though is when a region is selected another list is generated with towns.
So basically i need the above duplicating but don't know which bits need changing.
Thanks in advanced for the help.
Cheers,
Adam
I am using the following function to do a country/region ajax drop down list.
Code:
// JavaScript Document
var AdminResponse = "";
function parseResponse(){
var nText = AdminResponse.getElementsByTagName('optionText');
var nVal = AdminResponse.getElementsByTagName('optionVal');
document.forms[0]['region'].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[0]['region'].appendChild(nOption);
}
}
function update(nVal){
var AdminRequest = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
AdminRequest.onreadystatechange = function()
{
if (AdminRequest.readyState == 4)
{
if (AdminRequest.status == 200)
{
AdminResponse = AdminRequest.responseXML;
parseResponse();
}
else {
alert('Error Update.php File '+ AdminRequest.statusText);
}
}
}
var infoStr = "?choice="+nVal;
AdminRequest.open("GET", "Update.php"+infoStr, true);
AdminRequest.send(null);
}
So basically i need the above duplicating but don't know which bits need changing.
Thanks in advanced for the help.
Cheers,
Adam
Comment