如何获取下拉框选中的中文值 在action里如何获取下拉框选中的中文值?急。。有的给个例子。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String str = request.getParameter("下拉框的名字"); 重点JavaScript是如何得到选中的值 用了action就不要用js获取了啊,要获取的话document.getElementById("下拉框ID").value var _options = document.getElementById('oSelect2').options; for(var i = 0 ; i < _options.length;i++) { if(_options[i].selected) { alert(_options[i].value); alert(_options[i].text); } } <SELECT name="condSel"> <option value="-1"> --查询条件-- </option> <option value="0"> 价格 </option> <OPTION value="1"> 名称 </OPTION></SELECT>Action中:int cond=Integer.parseInt(request.getParameter("condSel"));是这样吗,好像不行,空指针异常。 把value的值和后面选项的值设一样的,document.getElementById("下拉框ID").value function getIndexText(ID){ var oSelect = document.getElementById(ID); return oSelect.options[oSelect.selectedIndex].text;} EXT4.0 Combox组件 proxy传值问题 求一个js正则如何写 js的问题 这个javascript脚本要怎么写才能在Firefox下正常啊 IE8下用JQUERY的HIDE方法以后DIV的MARGIN失效! window.open打开窗口的问题 时间验证问题 JS&XML 让自己画出的圆形,方形在直线上自左到右的移动.代码为何???急用!! 这个效果怎么实现啊 help me everybody <DIV>元素定位问题?送100分!!! 关于hta(HTML Application) 正则表达式替换能指定次数吗
document.getElementById("下拉框ID").value
for(var i = 0 ; i < _options.length;i++)
{
if(_options[i].selected)
{
alert(_options[i].value);
alert(_options[i].text);
}
}
<option value="-1">
--查询条件--
</option>
<option value="0">
价格
</option>
<OPTION value="1">
名称
</OPTION>
</SELECT>Action中:
int cond=Integer.parseInt(request.getParameter("condSel"));是这样吗,好像不行,空指针异常。
{
var oSelect = document.getElementById(ID);
return oSelect.options[oSelect.selectedIndex].text;
}