单击jsf按钮不工作时,通过javascript清除inputbox

单击jsf按钮不工作时,通过javascript清除inputbox,javascript,jsf,inputbox,Javascript,Jsf,Inputbox,(编辑问题,道歉) 我正在使用jsf 1.2和RichFaces3.3,我的代码片段如下:- function clearAll() { alert('test alert'); document.getElementById('frm_Employee:empName').value =""; } . . . <h:inputBox id="empName" .... /> <h:commandButton action="#{employeeBea

(编辑问题,道歉) 我正在使用jsf 1.2和RichFaces3.3,我的代码片段如下:-

 function clearAll()
{
  alert('test alert'); 
  document.getElementById('frm_Employee:empName').value ="";
}
.
.
.
    <h:inputBox id="empName" .... />

  <h:commandButton action="#{employeeBean.clearAll}"  value=" Clear" 
   onclick="clearAll();"  />
函数clearAll()
{
警报(“测试警报”);
document.getElementById('frm_Employee:empName')。value=“”;
}
.
.
.
“测试警报”打印,但输入文本框empName未清除。我的代码有什么问题


提前感谢。

输入框的呈现html是什么?
empName
不是
inputbox
,而是
h:commandButton
这是什么类型的选择器:
ID:ID
?您不能只使用
empName
?frm\u Employee是表单名。请使用view source或查看Firefox/Chrome控制台查看呈现的HTML,并为输入框添加HTML代码