zoukankan      html  css  js  c++  java
  • 对于使用jquery,chosen,easyui统一进行页面元素禁用公共方法

            function disableInput() {
                var datas = { comb_ship1: "", txt_CompWOCode: "", dtp_StartDate: "", dtp_EndDate: "", txt_EstDays: "", cbo_Vendor: "", text_RepairPort: "", Discharge: "", isNav: "", cbo_ApplyType: "", cbo_Faretype: "", ProjectNumber: "", Discount: "", ReliefAmount: "", cbo_currencyid: "", txt_Memo: "" };
                SetElementDisable(datas);
            }
    
            function SetElementDisable(datas) {
                debugger;
                for (var x in datas) {
                    var data = x;
                    var $data = $("#" + data);
                    if ($data.length == 0) {
                        continue;
                    }
                    if ($data.hasClass("easyui-numberbox")) {
                        $data.numberbox("disable");
                    }
                    else if ($data.hasClass("Wdate")) {
                        $data.prop("disabled", true);
                        $data.css("background-color", "#EBEBE4");
                    }
                    else if ($data.hasClass("easyui-combobox")) {
                        $data.combobox('disable');
                    }
                    else if ($data.hasClass("chosen-select")) {
                        $data.prop("disabled", true).trigger("chosen:updated");
                    }
                    else if ($data.prop("type") == "text") {
                        $data.prop("readonly", "readonly");
                        $data.css("background-color", "#EBEBE4");
                    }
                    else if ($data.prop("type") == "textarea") {
                        $data.prop("readonly", "readonly");
                        $data.css("background-color", "#EBEBE4");
                    }
                    else if ($data.type == "radio") {
                        $("#text").prop("data_obj");
                        var nameValue = $data.prop("name");
                        $("[name='" + nameValue + "']").prop("readonly", "readonly");
                    }
                    else {
                        $data.prop("disabled", true);
                        $data.css("background-color", "#EBEBE4");
                    }
                }
            }
    View Code
  • 相关阅读:
    C# 中的高性能计时器(Daniel Strigl著,野比译)(转)
    C#中SerialPort类 随笔
    迭代器
    枚举数与可枚举类型(笔记)
    jQuery的关注与学习
    敏捷开发的4句宣言 大数据
    bat脚本
    c++动态库中回调函数使用
    C++中遍历lua table
    vs2010编译release版本却依赖debug版本库msvcrd100.dll
  • 原文地址:https://www.cnblogs.com/zk3113/p/9583172.html
Copyright © 2011-2022 走看看