javascript - 使用 Javascript 的 Sharepoint 表单 Webpart

标签 javascript sharepoint

我正在尝试使用表单 web 部件执行以下操作

[用于输入产品编号的文本框字段] [提交按钮]

点击提交应该去:

http://www.link.com/product.asp?=[TextBox字段值]

最佳答案

这里实际上没有什么特定于 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/

相关文章:

javascript - 在动画更新时从父组件更新子组件 DOM

javascript - 将字符串值转换为 JavaScript 中的变量引用

AngularJS 中的 JavaScript 运行时错误 : Not enough storage is available to complete this operation.

javascript - jQuery - 为什么我不能将事件绑定(bind)到循环中的元素?

javascript - React-native,firestore : how to update component state when an instance variable changes its value

sharepoint - 我可以使用 C# 在 Sharepoint 2010 中为计算字段创建自己的公式吗

sharepoint - 带有 SharePoint 的 ADFS 2.0 未被识别为受信任的应用程序并抛出

asp.net - 无法加载应用程序页面中的类型错误

sharepoint - 沙盒 SharePoint 解决方案的错误处理策略

.net - 在 .Net 中调用 Web 服务时绕过无效的 SSL 证书错误