我正在使用JSF中的命令按钮。我不知道为什么我不能调用我的javascript函数。当我单击按钮时,不会显示警报。
<h:commandButton id="login" value="Login" action="login"
onclick="return checkPasswords();" type="Submit" />
我的Javascript函数:
function checkPasswords() {
alert("test");
return false;
}
<input type="button">
调用否则,它应该工作-我的当前代码库中有完全相同的代码,可以正常工作。
这正在工作
<script type="text/javascript">
function checkPasswords() {
alert("test");
return false;
}
</script>
<h:commandButton id="login" value="Login" action="login"
onclick="checkPasswords();" type="submit"/>
在type =“ submit”中以小写形式给出,type属性设置要为此组件创建的按钮的类型。此属性的有效值为“提交”和“重置”。此属性的默认值为“提交”。