javascript 获取select下拉列表值的代码
作者:bea
比如,在使用DWR的时候,如果你想传递下拉框的参数到后台的话,此时就需要先获取到下拉框的值了。 其实想要获取到下拉框的值是很简单的。 最关键的一段代码就是: 代码如下: onchange="show(this.options[this.options.selectedIndex].value);" onchange="show(this.options[this.options.selectedIndex].value);" show是一个自定义的函数名。 this
比如,在使用DWR的时候,如果你想传递下拉框的参数到后台的话,此时就需要先获取到下拉框的值了。
其实想要获取到下拉框的值是很简单的。
最关键的一段代码就是:
代码如下:
onchange="show(this.options[this.options.selectedIndex].value);"
onchange="show(this.options[this.options.selectedIndex].value);"
show是一个自定义的函数名。
this.options[this.options.selectedIndex].value才是主角!
有用 | 无用
其实想要获取到下拉框的值是很简单的。
最关键的一段代码就是:
代码如下:
onchange="show(this.options[this.options.selectedIndex].value);"
onchange="show(this.options[this.options.selectedIndex].value);"
show是一个自定义的函数名。
this.options[this.options.selectedIndex].value才是主角!
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- 关于javascript 回调函数中变量作用域的讨论
- 用DIV完美模拟createPopup 弹出窗口(),支持Firefox,ie,chrome
- javascript 一些用法小结
- JS 日期验证正则附asp日期格式化函数
- jquery 简单导航实现代码
- 禁止JQuery中的load方法装载IE缓存中文件的方法
- 一个用javascript写的select支持上下键、首字母筛选以及回车取值的功能
- 用Javascript 和 CSS 实现脚注(Footnote)效果
- Javascript 获取滚动条位置等信息的函数
- 用Javascript实现锚点(Anchor)间平滑跳转
- 用 Javascript 验证表单(form)中的单选(radio)值
- 用 Javascript 验证表单(form)中多选框(checkbox)值
- Javascript String.replace的妙用
- Javascript 检测、添加、移除样式(className)函数代码
- Javascript 阻止浏览器默认操作的实现代码
- javascript 流畅动画实现原理
- javascript 定义初始化数组函数
- JS 网页彩蛋 实现代码
- javascript十个最常用的自定义函数(中文版)