I'm having trouble getting a javascript to function. It should be called when a selectbox is changed or clicked...

These are the main javascript functions. I think this part is all right and the problem is in the 'onClick' event described at the bottom of the page:

<SCRIPT LANGUAGE='JavaScript'>

// function in_array(needle,haystack)
// craig heydenburg 4/8/02
// this function is similar to the PHP function of the same name
function in_array(needle,haystack) {
var bool = false;
for (var i=0; i<haystack.length; i++) {
if (array[i]==needle) {
bool=true;
}
}
return bool;
}
// function disableTimes (vol_id)
// craig heydenburg 4/8/02
// this function sets the value of said select boxes and disables them
function disableTimes (vol_id) {
// set the value to something meaningless
document.vol.elements['vol['+vol_id+'][etime][hr]'].value='01';
document.vol.elements['vol['+vol_id+'][etime][min]'].value='00';
document.vol.elements['vol['+vol_id+'][etime][ap]'].value='PM';
document.vol.elements['vol['+vol_id+'][stime][hr]'].value='02';
document.vol.elements['vol['+vol_id+'][stime][min]'].value='00';
document.vol.elements['vol['+vol_id+'][stime][ap]'].value='PM';
// disable the buttons
document.vol.elements['vol['+vol_id+'][etime][hr]'].disabled=true;
document.vol.elements['vol['+vol_id+'][etime][min]'].disabled=true;
document.vol.elements['vol['+vol_id+'][etime][ap]'].disabled=true;
document.vol.elements['vol['+vol_id+'][stime][hr]'].disabled=true;
document.vol.elements['vol['+vol_id+'][stime][min]'].disabled=true;
document.vol.elements['vol['+vol_id+'][stime][ap]'].disabled=true;
return true;
}
// function enableTimes (vol_id)
// craig heydenburg 4/8/02
// this function sets the value of said select boxes and disables them
function disableTimes (vol_id) {
// enable the buttons
document.vol.elements['vol['+vol_id+'][etime][hr]'].disabled=false;
document.vol.elements['vol['+vol_id+'][etime][min]'].disabled=false;
document.vol.elements['vol['+vol_id+'][etime][ap]'].disabled=false;
document.vol.elements['vol['+vol_id+'][stime][hr]'].disabled=false;
document.vol.elements['vol['+vol_id+'][stime][min]'].disabled=false;
document.vol.elements['vol['+vol_id+'][stime][ap]'].disabled=false;
return true;
}
// function getListValue(list)
// taken from http://developer.netscape.com/docs/examples/javascript/object_prop/properties.html
// collected April 8, 2002
function getListValue(list) {
var listValue = '';

if (list.selectedIndex != -1) {
listValue = list.options[list.selectedIndex].value;
}

return (listValue);
}
// function checkjob (list, vol_id) {
// craig heydenburg 4/8/02
// this function creates an array of the possible guide ids and sees if there is a match
// if so it calls the disableTimes function
function checkjob (job_id, vol_id) {
/* use php to print out a javascript array of the guide ids */
var guide_ids= new array(16);
// determine which value the user selected
var job_id = getListValue(list);
// determine if the given value (job_id) is in the guideid array
if (in_array(job_id,guide_ids)==true) {
disableTimes(vol_id);
} else {
enableTimes(vol_id);
}
// tell the form that the value was changed
document.vol.elements['vol['+vol_id+'][change]'].value=1;
return true;
}
</SCRIPT>

++++++++++++++

So here is the basic part of the form that is supposed to call the javascript:

<FORM NAME='vol' METHOD=POST ACTION='bo_vol_assign.php'>
<SELECT name='vol[1][duty]' CLASS='small' style='background-color:aqua; color:black' onClick="checkjob (this.form.elements['vol[1][duty]'], 1)">
<option value=''></option>
<option value=17 SELECTED>Usher</option>
<option value=21>corn dog maker</option>
<option value=22>stagehand</option>
<option value=16>Guide</option>
<option value=18>Security</option>
</SELECT>

I'm basically a novice javascripter and I'm not sure I have the onClick command correct. I think this is the error - maybe you could help?

thanks! craig