我有一个丰富的:日历:
<rich:calendar
id = "endDate"
value = ...
datePattern = "yyyy-MM-dd"
enableManualInput = "true"
disabled = "#{detailModel.mode == detailModel.viewMode}"
/>
我想使用 javascript 启用/禁用它。我有以下代码,但它对日历没有影响:
<script type="text/javascript">
//<![CDATA[
function setDafaults(defType, endDate, startTime)
{
var definitionType = defType.options[defType.selectedIndex].text;
if(definitionType == 'DEFAULT')
{
endDate.disabled = true;
startTime.value = "#{detailModel.afterObject.getDefaultStartTime()}";
}
else
{
endDate.disabled = false;
startTime.value = '';
}
}
//]]>
</script>
当 selectOneMenu 更改时调用该函数:
...
onchange="setDafaults(document.getElementById('detailForm:definitionType'),
document.getElementById('detailForm:endDate'),
document.getElementById('detailForm:startTime'))
...
我错过了什么/错误在哪里?