日期:2014-05-20 浏览次数:20841 次
///我这里直接禁用了button <asp:ImageButton ID="imgbtnClear" runat="server" ImageUrl="~/image/shouye/qinkong.png" onclick="imgbtnClear_Click" Enabled="false"/> js:从网上下载的插件 $(function(){ jQuery.fn.countDown = function(settings) { var cd=new Date(); var td=new Date(settings.startDate); var displayText=""; //开始构造显示用的字串 var secondDiff=cd.dateDiff("s",td); var dayDiff=parseInt(secondDiff/(60*60*24)); displayText+=(dayDiff>=0?dayDiff:"0")+"天 "; var hourDiff=parseInt(secondDiff/(60*60)); displayText+=(hourDiff>=0?hourDiff%24:"0")+"小时 "; var minuterDiff=parseInt(secondDiff/(60)); displayText+=(minuterDiff>=0?minuterDiff%60:"0")+"分 "; displayText+=(secondDiff>=0?secondDiff%60:"0")+"秒"; $(this).text(displayText).animate({"none":"none"},settings.duration,'',function() { if(secondDiff>=0) { //在这里,如果时间大于0,则启用按钮(难道我这个移除禁用按钮的代码写错了???求各位大神赐教) jQuery("#btnTouzhu").removeAttr("disabled"); $(this).countDown(settings); }else{ //如果时间小于等于0,按钮失效,这里可以 $("#imgTouzhu").attr({src:"../../image/shouye/ddkj.gif"}); $("#imgTouzhu").attr({"disabled":"disabled"}); settings.callBack(this); } }); return this; };