Return 到 InfoPath 中的表单顶部

Return to Top of Form in InfoPath

我发现这种 SharePoint 方法 return 到页面顶部 here。有谁知道将其集成到驻留在 SharePoint 上的 InfoPath 表单中的方法吗?

我发现使用 jQuery 的解决方法有限。我从这里下载了 .js 文件:

jquery-3.1.0.slim.min.js

将其保存到我的 SharePoint 网站,然后将以下内容嵌入到包含 InfoPath Web 部件的页面。

<script src="https://yoursharepointURL.com/SiteAssets/Scripts/jquery-3.1.0.slim.js"></script>

<script type="text/javascript">
function openLinkInSameWindow() {

 $('a[target="_blank"]').removeAttr('target'); 
}
 _spBodyOnLoadFunctionNames.push("openLinkInSameWindow");

</script>  

然后在 InfoPath 表单中,我使用以下 URL

调用脚本
https://yoursharepointURL.com/SitePages/Page.aspx#top

此后一直运行良好!