我正在尝试使用表单 web 部件执行以下操作
[用于输入产品编号的文本框字段] [提交按钮]
点击提交应该去:
最佳答案
这里实际上没有什么特定于 SharePoint - 这将直接在 html 页面中使用表单 web 部件或内容编辑器 web 部件 (CEWP) 同样工作
<!-- Catch Enter (KeyCode 13) and submit form -->
<div onkeydown="if (event.keyCode == 13) productSearch()">
<input type="text" name="productId" id="productId"/>
<input type="button" value="Go" onclick="productSearch()"/>
</div>
<script>
function productSearch()
{
var url = "http://www.link.com/product.asp?="
+ document.getElementById("productId").value;
// Open location in current window
window.location.href = url;
// or Open location in new window
window.open(url);
}
</script>
参见 window.open打开新窗口时更多选项的文档
关于javascript - 使用 Javascript 的 Sharepoint 表单 Webpart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2767461/