我调用一个javascript函数,点击一个隐藏的commandButton,但点击运行时页面加载,而不是当我调用函数。 这是html代码:调用一个Javascript函数,点击一个(隐藏)按钮或链接
<p:inputText id="aa" value="#{bonBonneManagedBean.sel}" onkeyup="fnc()" />
<h:commandButton id="hh" onclick="#{bonBonneManagedBean.kk()}" style="display:none"/>
以及JavaScript函数:
function fnc()
{
length = document.getElementById('form:aa').value.length;
if(length == 10)
{
$("#hh").click();
document.getElementById('form:aa').value = "";
}
}
另外,也许'hh'不是''生成的ID。 –
2013-02-11 14:22:37