gpt4 book ai didi

java - 如何从html :options collections获取选定选项值

转载 作者:行者123 更新时间:2023-11-28 09:01:17 24 4
gpt4 key购买 nike

我的 JSP 中有一个下拉菜单。如何从<html:options>中获取选定的值JSP 中的标记。

<html:select property="temp_Id"  >  
<html:options collection="listmap" property="key"/>
</html:select>

最佳答案

将标签更改为

<html:select property="temp_Id" styleId = "tempId" >
html:options collection="listmap" property="key"/>
</html:select>

在 java 脚本中添加以下内容

var e = document.getElementById("tempId");
var strUser = e.options[e.selectedIndex].value;

这应该可以。谢谢。

关于java - 如何从html :options collections获取选定选项值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17696911/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com