此页面在newwindow中打开。 我有一个文本框和两个按钮(h:commandbutton和a4j:commandButton)。防止默认操作
我将(设置)光标焦点移动到文本字段中。
我的问题是,我从文本框命中输入按钮,然后自动调用h:comandButton动作并关闭新窗口。如何避免这一点。
但是,我需要的,当我按下回车键,将光标移动焦点到A4J:的commandButton
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function a4jButtonClick()
{
alert("A4J Command Buton clicked...");
}
</script>
</head>
<body>
<h:form id="sampleForm">
<rich:panel id="samplePanel">
<h:outputText value="User Name : "/>
<h:inputText/>
<h:commandButton value="Closing-CommandButton"
onclick="javascript:window.close();return false;"/>
<a4j:commandButton value="A4JCommandButton" onclick="a4jButtonClick()"/>
</rich:panel>
</h:form>
</body>
</html>
</f:view>
如果我打从textfiled回车键,我想调用脚本警报(“A4J Command Buton clicked ...“);
帮帮我。 提前致谢。
感谢您的回复。现在我更新我的问题。我使用return false。尽管窗户关闭。 – Eswar 2011-02-18 06:19:26