Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript icefaces 3表单onkeydown事件don';t火_Javascript_Icefaces 3 - Fatal编程技术网

Javascript icefaces 3表单onkeydown事件don';t火

Javascript icefaces 3表单onkeydown事件don';t火,javascript,icefaces-3,Javascript,Icefaces 3,我用的是冰面3 我想在按下表单上的enter键时执行javascript函数 我在以前的应用程序(在IceFaces1.8上)中使用了这段代码,它工作得很好。 但现在这在Icefaces3中不起作用: 这是我的密码: <ice:form id="queryForm" onkeydown="submitOnEnter(event);"> 在我的标题中,我有: <script type="text/javascript"> function submitOnEn

我用的是冰面3

我想在按下表单上的enter键时执行javascript函数

我在以前的应用程序(在IceFaces1.8上)中使用了这段代码,它工作得很好。 但现在这在Icefaces3中不起作用:

这是我的密码:

<ice:form id="queryForm" onkeydown="submitOnEnter(event);">

在我的标题中,我有:

<script type="text/javascript">
    function submitOnEnter(event){
        alert("submitOnEnter");
    if( event.keyCode == 13 || evt.keyCode == 13 )
         {
    document.getElementById('queryForm:formSubmit').click();
    }
 };
 </script>

函数submitOnEnter(事件){
警报(“提交中心”);
if(event.keyCode==13 | | evt.keyCode==13)
{
document.getElementById('queryForm:formSubmit')。单击();
}
};
当我使用按键事件时,javascript不起作用,但当我使用鼠标事件时,它们工作正常


我怎样才能解决这个问题

调用函数时,请尝试将事件作为参数删除:submitOnEnter();。也许会有帮助,谢谢。我找到了一个解决办法我把冰藏起来了:形式。。。至“ice:form id=“queryForm”onkeydown=“submitOnEnter(事件);“partialSubmit=”true“”