PDA

View Full Version : return a value to list/menu box



jennifer_y
Jul 19th, 2007, 07:57 AM
Hi...i'm in the progress on writing javascript with Ajax design. I would like to return a value from data (MS Access) to the "country" selection box below are my javascript function:-

function stateChanged(frm)
{
if (xmlHttp.readyState==4)
{
var xmlDoc=xmlHttp.responseXML.documentElement;
if (xmlDoc.getElementsByTagName("pro_buyer")[0].childNodes[0].nodeValue!="")
{
document.form.pro_buyer.value =xmlDoc.getElementsByTagName("pro_buyer")[0].childNodes[0].nodeValue;
document.form.country.value =xmlDoc.getElementsByTagName("pro_country")[0].childNodes[0].nodeValue;

}
}
}

appreciate that someone can help on this. I should code ( document.form.country??????? =xmlDoc.getElementsByTagName("pro_country")[0].childNodes[0].nodeValue;)

mcjwb
Jul 19th, 2007, 09:31 AM
You will find some very useful information on the Quirksmode site, inparticular his section on Dynamic Options (http://www.quirksmode.org/js/options.html). Unfortunately his example isn't woring at the moment, but this is due to a him referencing the wrong form (I think he must have recently added a search form above the example so the example form is no longer forms[0]).

Hope this helps.