Ficus,
Try these changes (everything else stays the same).
Can't test without turning on The Terminator, my dev machine, so will probably still need debugging but you should get the gist of it.
NotesI have hard-coded 'cat1' in checkNew(). There's no need to send it to the server and back as checkNew() is single-purpose, not reused. This simplified things a lot, and was maybe one cause of the problem you were having.
In checkNew() document.getElementById() is unavoidable(?), note the back compatibility for (some) older browsers.
In checkSelected() and checkNew() poststr is built with an array join. This is good practise as it avoids potential misuse of + (which has two meanings in js).
Passing this to the select menu handlers saves the need for document.getElementById().
In checkNew() poststr is built with both cat1 and cat2 values (correctly I hope).
In HTML, onselect should be onselect="foo();" not onselect="javascript:foo();" , unlike with href, where a URL is expected and you have to tell the browser if it's javascript (but there's no real need to do that either).
In testA.php I have replaced if/else if/else with a switch structure, which is much neater.
Javascript:
function checkSelected(list) {
var poststr = ['cat1=', encodeURI(list.options.value)].join('');
AjaxCRequest('testA.php', poststr, 'div1', 0);
}
function checkNew(list) {
var cat = (document.getElementById) ? document.getElementById('cat1') : document.all['cat1'];
var poststr = ['cat1=', encodeURI(cat.options.value), '&cat2=', encodeURI(list.options.value)].join('');
AjaxCRequest('testB.php, poststr, 'div2', 0);
}
HTML
<select name="cat1" class="text_black" onChange="checkSelected(this);">
*** testA.php ***
<?php
$cat1 = $_POST['cat1'];
?>
<select name="cat2" class="text_black" onChange="checkNew(this);">
<option value="0">--select--</option>
<?php
switch($cat1) {
case '1':
?>
<option value="1">Cat</option>
<option value="2">Dog</option>
<option value="3">Bird</option>
<?php
break;
case '2':
?>
<option value="1">Truck</option>
<option value="2">Sports</option>
<option value="3">Racing</option>
<?php
break;
default:
?>
<option value="1">Tree</option>
<option value="2">Shrub</option>
<option value="3">Groundcover</option>
<?php
}
?>
</select> Let us know how it goes.Airshow