未从onclick调用JavaScript函数

未从onclick调用JavaScript函数,javascript,jsf,icefaces,Javascript,Jsf,Icefaces,我尝试从icefaces复选框组件调用JavaScript函数,如下所示: <ice:selectBooleanCheckbox value="#{reportBean.selected}" onclick="toggleSelectAllRows()" /> 那么JavaScript代码是: <script> function toggleSelectAllRows() { alert("Entered selectAll"); }

我尝试从icefaces复选框组件调用JavaScript函数,如下所示:

 <ice:selectBooleanCheckbox value="#{reportBean.selected}"      onclick="toggleSelectAllRows()" />

那么JavaScript代码是:

<script>
  function toggleSelectAllRows() {
    alert("Entered selectAll");
  } 

  } 
</script>

函数切换SelectAllRows(){
警报(“全部输入”);
} 
} 

但选中该复选框后,不会显示警报框。原因可能是什么?

如果这确实是您的JavaScript代码,那么末尾的
}
太多,从而阻止您的JavaScript被解析(和执行)


函数切换SelectAllRows(){
警报(“全部输入”);
} 

生成的原始HTML是什么?javascript函数中的括号不匹配我将以onclick=“alert('test')”开头;查看事件处理程序是否按预期工作。
<script>
function toggleSelectAllRows() {
  alert("Entered selectAll");
} 
</script>