js操作DropDownList大全
来源:互联网 发布:ftp主进程端口 编辑:程序博客网 时间:2024/06/12 11:06
一:js 设置DropDownList选中某项
1.根据Value值设置选中某项 例子如下:
HTML代码:
view plaincopy to clipboardprint?
JS代码:
document.getElementById("ddlFolder").value="0";//0为你要选中的项的value
2.根据Text值设置选中某项
var DropDownListCurrencyNew
= document.getElementById("ddlFolder");
for(i= 0; i< DropDownListCurrencyNew.options.length; i++)
{
if(DropDownListCurrencyNew.options[i].text== "选项0")
{
DropDownListCurrencyNew.options[i].selected =true;
}
}
二:js读取DropDownList选中项的value和text
Value:
var selValue =document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].value;
Text:
var selText = document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].text- js操作DropDownList大全
- JS 对 DropDownList 操作
- js操作DropDownList
- js操作DropDownList 与 RadioButtonList
- DropDownList一些操作(JS)
- JS简单操作select和dropdownlist
- 操作DropDownList、CheckBoxList和RadioButton的js
- js 操作表格大全
- JS操作Cookie 大全
- JS操作Cookie 大全
- Js操作Select大全
- Js操作Select大全
- js数组操作大全
- Js操作Select大全
- js数组操作大全
- js数组操作大全
- Js操作Select大全
- Js操作Select大全
- PDA系统之现场测试--跳跃性成长的过程(一)
- IO系统_文件的切割和合并
- c++ 类型转换
- poj 2886
- 基于网络的Linux自动化安装
- js操作DropDownList大全
- Java异常处理中,try {}里有一个return语句,那么紧跟在这个try后的finally {}里的code会不会被执行,什么时候被执行,在return前还是后?
- asp.net mvc 出现 HTTP 404
- getRequestDispatcher()与sendRedirect()的区别
- PDA系统之现场测试--跳跃性成长的过程(二)
- C++_对象与类
- 程序员求职之道(《程序员面试笔试宝典》)之面试官箴言?
- java.lang.String的trim()的用法
- Unity3D图像后处理特效——Contrast Enhance