手记

jquery-dialog按钮设置灰色不可点击操作

         

var editupdate=function(){var appId=process_appId;$("#editupdate").dialog('option','appId',appId);var dlg = document.getElementById("editupdate");var elements = dlg.getElementsByTagName("INPUT")for( i = 0 ; i < elements.length ; i++ ){var item = elements.item(i);if(item.name=="finishtime"){      var date= new Date(applyAll[appId][item.name]);            //日期格式化      var days= date.getDate(); //从 Date 对象返回一个月中的某一天 (1 ~ 31)。                      var months=date.getMonth()+1;//从 Date 对象返回月份 (0 ~ 11)。                      var years=date.getFullYear();//从 Date 对象以四位数字返回年份。                      var hours=date.getHours();//返回 Date 对象的小时 (0 ~ 23)。                      var minutes=date.getMinutes();//返回 Date 对象的分钟 (0 ~ 59)。                      var seconds=date.getSeconds();//返回 Date 对象的秒数 (0 ~ 59)。      if(days<10){        days="0"+days;      }      if(hours<10){        hours="0"+hours;      }      if(minutes<10){        minutes="0"+minutes;      }      if(seconds<10){        seconds="0"+seconds;      }        if(months<10){        months="0"+months;      }      item.value=years+"-"+months+"-"+days+" "+hours+":"+minutes+":"+seconds;      if(item.value=="NaN-NaN-NaN NaN:NaN:NaN"){      item.value="nullvalue";      }      }else{      item.value = applyAll[appId][item.name];         }               }var elements = dlg.getElementsByTagName("SELECT");for( i = 0 ; i < elements.length ; i++ ){var item = elements.item(i);item.value = applyAll[appId][item.name];//按钮判断禁用if(item.value=="finish"){              $("#editupdate").parent().find("button").each(function() {                             if( $(this).text() == '修改' ) {                                $(this).attr('disabled', true);                               }                             });}else{                            $("#editupdate").parent().find("button").each(function() {                             if( $(this).text() == '修改' ) {                                $(this).attr('disabled', false);                               }                             });}}$("#editupdate").dialog("open");};





0人推荐
随时随地看视频
慕课网APP