Date: 04/06/07 (Web Development) Keywords: php, browser, html, xml, microsoft I have a form of potentially 8 select menus, the goal of which is when you change the value it calculates a new cost based on the choices made. In order to bypass the annoying IFRAME issue of ruining your browser back button I'm looking into alternative scripting options - and while I am woefully unfamiliar with AJAX it seems to be my best option. var AJAXForms = false;
var LastField = null;
var isIE = false;
if (window.XMLHttpRequest) {
AJAXForms = new XMLHttpRequest();
}
function CheckField(field) {
if (window.XMLHttpRequest) {
} else if (window.ActiveXObject) {
AJAXForms = new ActiveXObject("Microsoft.XMLHTTP");
}
AJAXForms.onreadystatechange = processChange;
AJAXForms.open("GET", "check.php?&quantity="+field.value);
LastField = field.name;
AJAXForms.send(null);
}
function processChange() {
if (AJAXForms.readyState == 4) {
var res = document.getElementById(LastField);
res.innerHTML = AJAXForms.responseText;
res.style.visibility = "visible";
}
}With HTML of 'OnChange="CheckField(this)"' attached to the dropdown. So what I'd like to do is either a.) Get this script to support up to 8 variables or b.) Get some direction on examples / tutorials in order to write one myself. Any help would be much appreciated.
|