javascript - 如何使用 javascript html 填充具有多个路径的下拉列表
问题描述
我正在处理 Excel Web 加载项项目,我需要与多个共享文件夹路径建立连接。当用户在下拉列表中选择路径时,它会自动获取数据并在 Excel 表中打开它。我在 Visual Studio 中使用 JavaScript 和 HTML。
所以这是我的 HTML 代码:
<td><label class="ms-Label is-required ms-font-l">Path : </label></td>
<td>
<select class="ms-Dropdown-item--selected is-required" id="path">
<option href="\\myservername.com\Fin1\ ">Server 1</option>
<option href="\\myservername.com\Fin2\ ">Server 2</option>
<option href="\\myservername.com\Fin3\ ">Server 3</option>
</select>
</td>
<script>
document.getElementById('path').onchange = function (ctx) {
window.location.href = this.children[this.selectedIndex].getAttribute('href');
} </script>
每个选项都与不同的服务器路径连接。我尝试使用window.location.href但是当我选择服务器路径时,输出替换了我的表单。我希望它在 Excel 工作表上显示输出而不是替换我的表单。
解决方案
推荐阅读
- sdk - gsutil 路径名未从命令行传递到目标存储桶
- php - 从选择选项 html 中读取多个值
- ios - 如何找到按下的子层?
- ios - 谷歌地图在iOS Swift中按纬度和经度放置信息
- neo4j - graphaware 是否支持 neo4j 中的荷兰语 nlp?
- xml - 在骆驼路线中获取具有特定字符串的文件名
- python - Python 覆盖在本地针对 docker 中的相同服务运行测试
- sap - 接收 IDOC 作为没有架构的 xmldocument
- python - kivy 中引用的 2 个类返回空屏幕
- c# - 如何将数据库中的大数据检索到 ASP.Net 中的 Gridview 中?无分页