1

我已经从Richfaces Showcase 的演示中在文本框中制作了焦点示例项目。我使用 JSF 2.0、Richfaces 4.3.0 Final.jar 和 Jboss 7 服务器。我可以成功运行该项目,但焦点不起作用。当我按 Tab 键时,焦点到达文本框。如果有什么我需要配置的,请告诉我。

提前致谢。

4

1 回答 1

0
Finally, I got it. I put the javascript code in the jsf form just like this.
<h:form id="frm">
<script type="text/javascript"> 
window.onload = function() {
        document.getElementById('frm:txtStaffId').focus();
}
</script>
...
...
<h:inputText id="txtStaffId"/>
...
...
</h:form>
于 2013-11-15T03:03:22.873 回答