/**
* 设置select选中
* @param selectId select的id值
* @param checkValue 选中option的值
*/
function setSelectChecked(selectId, checkValue){
var select = document.getElementById(selectId);
for(var i=0; i<select.options.length; i++){
if(select.options[i].innerHTML == checkValue){
select.options[i].selected = true;
break;
}
}
};

另外selectedindex; 这个属性是判断选中的是第几个options

修改select选中项的更多相关文章

  1. layui动态修改select的选中项

    layui动态修改select的选中项:(在layUI下给select设置默认选项) 例: $("select[name='result']").val(11); //重新渲染表单 ...

  2. Jquery设置select控件指定text的值为选中项

    <select name="streetid" id="streetid"> <option value="4">北 ...

  3. angularjs中设置select的选中项

    最近用angularjs比较多,里面有很多自己的方法,都不咋会用,这篇只是个笔记,防止自己忘记 <select style="width:100%" ng-model=&qu ...

  4. 修改select下拉选的默认选中值

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  5. PHP 根据php传的值修改 select 中动态生成的 option 组的默认选中值

    有一个情况今天遇到了:通过后台传过来的一组下拉框的option值,需要默认选中其中某一项. html 部分是这样的: <select class="form-control" ...

  6. angularjs ng-select ng-options 默认选中项.

    <!DOCTYPE html> <html ng-app="myApp"> <head> <meta charset="utf- ...

  7. 使用val()方法设置表单中的默认选中项

    有时候我们展示给用户的表单中的checkbox,radio,selec等标签的一些项是默认选中的.比方:当用户改动文章的时候,假设相应的栏目为下拉框的话,那么它的默认选中值应该是原来的栏目位置. 能够 ...

  8. CTreeCtrl点击获得选中项

    相应TVN_SELCHANGED可以得到选中的项,在相应函数内如下: LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(p ...

  9. wpf中ListBox的选中项与ComboBox间的绑定

    产品类: public class Product:NotificationObject { private int productID; public int ProductID { get { r ...

随机推荐

  1. POJ 2761 Feed the dogs

    主席树,区间第$k$大. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> ...

  2. css基础和心得(一)

     css开始 p{    font-size:12px;    color:red;    font-weight:blod } p为选择符p{}又称选择器,指明网页中要应用样式规则的元素.属性和值之 ...

  3. PHP微信支付开发之扫描支付(模式二)后如何回调

    其实在写这篇文章的时候感觉自己已经落伍了,不过笔者在百度上搜索"微信支付开发之扫描支付(模式二)后如何回调"寻找答案时,发现依旧有很多朋友没有解决这个问题,所以就把自己的解决思路分 ...

  4. [河南省ACM省赛-第三届] 网络的可靠性 (nyoj 170)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include<iostre ...

  5. BFS - leetcode [宽度优先遍历]

    127. Word Ladder int size = q.size(); for(int k = 0; k < size; k++){//for 次数 找到一个erase一个 q里面加入的是所 ...

  6. sharepoint代码添加WebPart

    Adding a web part   Following code snippet can be used to add a web part in an existing SharePoint w ...

  7. ECOS-Ecstore证书生产失效问题排查

    无法生成证书问题排查 无法生成证书问题排查 author :James,jimingsong@vip.qq.com since :2015-03-02 名称解释(官方) 常见错误 1. 名称解释(官方 ...

  8. php笔记(六)PHP类与对象之对象接口

    接口的实现 <?php //interface 关键字用于定义一个接口 interface ICanEat{ //接口里面的方法不需要实现 public function eat($food); ...

  9. 升级到macSierra 10.12之后 在模拟器上面滑动视图很卡,

    解决方法 在终端里面输入sudo sysctl -w kern.timer.coalescing_enabled=0

  10. Java List&Map简单初始化方法

    Java中List与Map初始化的一些写法 // InitCollections.java - sample of init collect package com.util; import java ...