zoukankan      html  css  js  c++  java
  • util.select.js

    ylbtech-JavaScript-util: util.select.js

    筛选工具

    1.A,JS-效果图返回顶部
     
    1.B,JS-Source Code(源代码)返回顶部
    1.B.1, m.yintai
    /*
    取得选中的名称
    */
    function getSelectedText(controlID) {
        var selectedText = null;
        $("#" + controlID + " option").each(function () {
            if ($(this).attr("selected")) {
                selectedText = $(this).text();
                return false;
            }
        });
        return selectedText;
    }
    /*
    根据文本选中项
    */
    function selectByText(controlID, text) {
        $("#" + controlID + " option").each(function () {
            var currentText = $(this).text();
            if (currentText == text) {
                $(this).attr("selected", true);
                return false;
            }
        });
    }
    /*
    根据文本选中项
    */
    function selectByValue(controlID, value) {
        $("#" + controlID + " option").each(function () {
            var currentValue = $(this).attr("value");
            if (currentValue == value) {
                $(this).attr("selected", true);
                return false;
            }
        });
    }
    /*
    根据文本取得值
    */
    function getValueByText(controlID, text) {
        var value = null;
        $("#" + controlID + " option").each(function () {
            var currentText = $(this).text();
            if (currentText == text) {
                value = $(this).attr("value");
                return false;
            }
        });
        return value;
    }
    View Code

    1.B.2,

    1.C,JS-Relevent References(相关引用)返回顶部

     

    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    python编码问题和py2和py3的不同
    day27
    多继承补充
    zoj3820 Building Fire Stations 树的中心
    DLX舞蹈链 hdu5046
    时间复杂度
    线性求中位数 poj2388
    codeforce447 D SGU 548 贪心+优先队列
    hdu4864 hdu4268 贪心 lower_bound
    zoj3672 Gao The Sequence
  • 原文地址:https://www.cnblogs.com/ylbtech/p/3852599.html
Copyright © 2011-2022 走看看