比如,在使用DWR的时候,如果你想传递下拉框的参数到后台的话,此时就需要先获取到下拉框的值了。 其实想要获取到下拉框的值是很简单的。 最关键的一段代码就是: 复制代码 代码如下: onchange="show(this.options[this.options.selectedIndex].value);" onchange="show(this.options[this.options.selectedIndex].value);" show是一个自定义的函数名。 this.options[this.options.selectedIndex].value才是主角!
推荐阅读
用 Javascript 验证表单(form)中的单选(radio)值
本文介绍了一个较为通用的获取 radio 值的方法,希望对新手有用。 复制代码 代码如下: <script type="text/javascript"> // 说明: 用 Javascript 验证表单(form)中的单选(radio)值 // 作者: CodeBit functio>>>详细阅读
本文标题:javascript 获取select下拉列表值的代码
地址:http://www.17bianji.com/kaifa2/JS/28173.html
1/2 1