首页 > 代码库 > 修改button值

修改button值

/// <summary>设置button可用</summary>function FunSetButtonTrue(name) {    document.getElementById(name).disabled = false;//true不可用 false可用    document.getElementById(name).value = http://www.mamicode.com/"保存";}/// <summary>设置button不可用</summary>function FunSetButtonFalse(name) {    document.getElementById(name).disabled = true;//true不可用 false可用    document.getElementById(name).value = http://www.mamicode.com/"正在提交...";}/// <summary>获取参数</summary>function RequestName(strName) {    var strHref =http://www.mamicode.com/ window.document.location.href;    var intPos = strHref.indexOf("?");    var strRight = strHref.substr(intPos + 1);    var arrTmp = strRight.split("&");    for (var i = 0; i < arrTmp.length; i++) {        var arrTemp = arrTmp[i].split("=");        if (arrTemp[0].toUpperCase() == strName.toUpperCase())            return arrTemp[1];    }    return "";}

用法

 function FunSubmit() {            var identificationImage = $("#mainbox img").attr("src");            var driverLicenseImage = $("#mainbox1 img").attr("src");            var creditCardImage = $("#mainbox2 img").attr("src");            var hidValue = http://www.mamicode.com/$("input[name=‘__RequestVerificationToken‘]").val();            FunSetButtonFalse("btnSubmit"); //此处应用            $.ajax({                url: "/Verification/Index",                dataType: "json",                type: "POST",                data: { identificationImage: identificationImage, driverLicenseImage: driverLicenseImage, creditCardImage: creditCardImage, __RequestVerificationToken: hidValue },                success: function(data) {                    if (data.Status == "0") {                        alert(data.ErrMsg);                        FunSetButtonTrue("btnSubmit"); //此处应用                        return;                    } else {                        alert(data.ErrMsg);                        FunSetButtonTrue("btnSubmit");  //此处应用                        window.location.href = window.location.href;                    }                },                error: function() {                    alert("网络错误,请重试!");                }            });        }

 效果

修改button值