I want to combine the return value of the ukaccess function into the value set by the setarea function but I’m not experienced enough to know what to do next. Hopefully, the code is correct so far.
function ukaccess(){
var dbasedata = document.forms[0]._dbase_name.value;
dbasedata = dbasedata.toUpperCase();
if (dbasedata.indexOf("UK_CONTACTS")>-1) {
return "UK_CONTACTS";
}
}
function setarea(){
var postcode2 = document.forms[0]._postalcode.value;
var trim_pcode = (postcode2.substr(0,8));
trim_pcode = trim_pcode.toUpperCase();
trim_pcode = trim_pcode.replace(/\s/g, "");
if (trim_pcode == "W1W6UW" || trim_pcode == "W1G8HU") {
//alert("London-Xover");
document.forms[0]._area.value = "North London" [ukaccess function return value here];
Try