The issue is that selects themselves don't have values. You notice
the value is on the option tag, not the select.
So you can't just get the .value of the element with ID
'subcategory'; you need to get the value of the currently selected
item OF that select box. That can be done as an inline declaration,
but shouldn't be.
The best bet is to get both values within the showSubcategory2
function. Remove both parameters to the showSubcategory2 function and
calculate them in the function:
HTML:
<select name="subcategory" id = "subcategory"
onchange="showSubcategory2()">
JavaScript:
function showSubcategory2() {
var categorySelect = document.getElementById('category');
var subcategorySelect = document.getElementById('subcategory');
var category = categorySelect.options
[categorySelect.selectedIndex].value;
var subcategory = subcategorySelect.options
[subcategorySelect.selectedIndex].value;
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert ("Browser does not support HTTP Request");
return;
}
var url = "getsubcategory2.php";
url = url + "?category2="+category;
url = url + "&subcategory2="+subcategory;
url = url + "&sid="+Math.random();
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
...or better yet, remove the onchange attribute from your select tag
completely and implement the onchange unobtrusively as I detailed
last time.
Hope that helps,
Kit
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************