需要JSF表单中的自动单击功能
加载下面的JSF页面后,我需要自动单击登录链接。请帮忙! 单击登录链接后,此表单将显示一个登录链接并打开一个新窗口。 如果我可以直接提交表格而不显示登录链接也可以需要JSF表单中的自动单击功能,jsf,jsf-2,Jsf,Jsf 2,加载下面的JSF页面后,我需要自动单击登录链接。请帮忙! 单击登录链接后,此表单将显示一个登录链接并打开一个新窗口。 如果我可以直接提交表格而不显示登录链接也可以 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http:/
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<head>
<title>MY System ®</title>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="My System" />
<link rel="stylesheet" type="text/css"
href="${facesContext.externalContext.requestContextPath}/style/source.css"></link>
<script type="text/javascript"
src="${facesContext.externalContext.requestContextPath}/js/Utility.js"></script>
</head>
<body>
<ui:include src="common/header.xhtml" />
<div class="table"
style="position: absolute; top: 160px; width: 960px; text-align: center; float: center; margin-left: auto;">
<form id="initForm">
<span class="warning"> Welcome to MY System, please <a
href=""
onclick="newSourceWindow('${facesContext.externalContext.requestContextPath}/home.jsf');"
style="color: blue; text-decoration: underline; cursor: pointer;">Login</a>
to start. </span>
</form>
<rich:spacer height="40" />
<ui:include src="common/footer.xhtml" />
</div>
</body>
</html>
var spanEle = document.getElementById('welcomeLink');
spanEle.click()
我的系统®;
欢迎使用我的系统
开始。
给你的span
提供Id通过Javascript访问它,您可以用它做任何事情,在您的情况下,触发单击
<span id="welcomeLink">
...
</span>
var spanEle = document.getElementById('welcomeLink');
spanEle.click()