This might get you going in the right direction....
PerformCS would be set to fire on the onchange event for the first select box and would pass the value of the selected option (this.value). It makes a call to the server (in this case using an asp page). After the server page is done, it returns to the FillBox2 javascript function.
Code:
function PerformCS(theValue) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Browser does not support HTTP Request");
return;
}
var url="CSProcess.asp";
url=url+"?theValue="+theValue;
url=url+"&sid="+Math.random(); //prevents a cached version from being used
xmlHttp.onreadystatechange=FillBox2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
CSProcess.asp
--Here you would take the value passed by "theValue" and get the options needed based on this. You can then create the html for the select input.
Code:
function FillBox2() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
var theResponse = xmlHttp.responseText;
//theResponse has whatever you returned from CSProcess.asp (ie the code for the select input). You can then insert this text into the document where you want it using innerHTML
}
}
This is cross browser code to set the object....
Code:
function GetXmlHttpObject() {
var objXMLHttp=null;
if (window.XMLHttpRequest) {
objXMLHttp=new XMLHttpRequest();
}
else if (window.ActiveXObject) {
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLHttp;
}
Bookmarks