• jquery disabled


    <table width="1000px" border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
            <tr>
                <td style="text-align: center; vertical-align: middle;">
                    <div class="easyui-panel" style=" 640px; height: 260px; padding: 10px;">
                        <p><b>ShareFolder Path: </b><span id="shareFolderPath"></span></p>
                        <p><b>Files to process </b>(Person xml file count <span id="personCount" style="color: red;">0</span>, Entity xml file count <span id="entityCount" style="color: red;">0</span>)</p>
                        <p><b>Result: </b><span id="parsingResult"></span></p>
                    </div>
                </td>
            </tr>
            <tr>
                <td height="50" align="center" valign="middle">
                    <input type="button" id="btnStartParsing" name="btnStartParsing" value="Start Parsing" />
                    <input type="button" id="btnTest" name="btnTest" value="Test" />
                </td>
            </tr>
        </table>
    <script type="text/javascript">
    
            var url = window.location.href.toLocaleLowerCase().replace("index.aspx", "Handler.ashx");
    
            $(document).ready(function () {
    
    
                getShareFolderPath();
    
                loadShareFolderXml();
    
                $("#btnStartParsing").click(function () {
                    return btnParsingOnClick();
                });
    
                $("#btnTest").click(function () {
                    return btnTestOnClick();
                });
            });
    
            function getShareFolderPath() {
                $.ajax({
                    type: "GET",
                    url: url + "?action=getsharefolderpath&r=" + Math.random(),
                    dataType: "json",
                    data: null,
                    async: true,
                    success: function (json) {
                        if (json.result) {
                            $("#shareFolderPath").html("<a href="" + json.data + "" target="_blank">" + json.data + "</a>");
                        }
                        else {
                            alert(json.msg);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); }
                })
            }
    
            function loadShareFolderXml() {
                $.ajax({
                    type: "GET",
                    url: url + "?action=initfolder&r=" + Math.random(),
                    dataType: "json",
                    data: null,
                    success: function (json) {
                        if (json.result) {
                            if (json.data.personCount != null) {
                                $("#personCount").text(json.data.personCount);
                            }
                            if (json.data.personCount != null) {
                                $("#personCount").text(json.data.entityCount);
                            }
                            if (parseInt(json.data.personCount) > 0 || parseInt(json.data.entityCount) > 0) {
                                $("#btnStartParsing").prop("disabled", false);
                                $("#btnStartParsing").removeAttr("disabled");
                            }
                            else {
                                $("#btnStartParsing").prop("disabled", true);
                            }
                        }
                        else {
                            $("#btnStartParsing").prop("disabled", true);
                            alert(json.msg);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
    
                        $("#btnStartParsing").prop("disabled", true);
                        alert(textStatus);
                    }
                })
            }
    
            function btnParsingOnClick() {
                $.ajax({
                    type: "GET",
                    url: url + "?action=startparsing&r=" + Math.random(),
                    dataType: "json",
                    data: null,
                    async: true,
                    beforeSend: function () {
                        //$("#btnStartParsing").prop("value", "Processing, please wait...,Do not click again or close page");
                        $("#btnStartParsing").val("Processing, please wait...,Do not click again or close page");
                        $("#btnStartParsing").prop("disabled", true);
                    },
                    success: function (json) {
    
                        $("#parsingResult").text(json.msg);
    
                        loadShareFolderXml();
                    },
                    complete: function () {
                        $("#btnStartParsing").val("Start Parsing");
                        loadShareFolderXml();
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); }
                });
    
                return false;
            }
            function btnTestOnClick() {
                var btn = $("#btnTest");
                //btn.prop("value", "Processing, please wait...,Do not click again or close page");
                btn.val("Processing, please wait...,Do not click again or close page");
                btn.prop("disabled", true);
    
                setTimeout(function () {
    
                    btn.val("Start Parsing");
                    btn.prop("disabled", false);
    
                }, 5000);
    
    
                return false;
            }
    
        </script>
  • 相关阅读:
    webpack 打包性能分析工具
    npm 使用
    npm 构建时,次要版本变化引起的问题
    AtomicStampedReference、AtomicMarkableReference 区别
    vue-cli 中的静态资源处理
    vue-cli 构建项目中 config/index.js 文件解读
    webpack的3个路径配置项: assetsRoot、assetsSubDirectory、assetsPublicPath
    Vue2 dist 目录下各个文件的区别
    DllPlugin、DllReferencePlugin 可以提取的第三方库列表
    JUC集合之 CopyOnWriteArrayList
  • 原文地址:https://www.cnblogs.com/hofmann/p/12761348.html
Copyright © 2020-2023  润新知