一个jq投票,无论成功与否3秒后自动关闭提示框

来源:互联网 发布:黎姿长相知乎 编辑:程序博客网 时间:2024/05/22 01:49
<link rel="stylesheet" href="/pages/js/ui/dialog/jquery-ui-1.8.16.custom.css" type="text/css" media="screen,projection" charset="utf-8"/><script type="text/javascript" src="/pages/js/ui/jquery-1.6.2.min.js"></script><script type="text/javascript" src="/pages/js/ui/dialog/jquery-ui-1.8.16.custom.min.js"></script><div id="auth" style="display:none;"><table align="left" style=" font-size:14px;" cellpadding="3" cellspacing="0"><tbody><tr><td style=" text-align:right; white-space:nowrap;">验证码:</td><td style=" text-align:left;"><input style=" width:60px;" maxlength="4" id="gdcode" type="text"/></td></tr><tr><td style="text-align:right;" id="td_gdcode">   </td><td style=" text-align:left; white-space:nowrap;"><a href="javascript:void();" onClick="javascript:document.getElementById('code').src='/special/tee2012/gdcode.html?dt='+Math.random();return false;"><font color="0d5eff">看不清楚</font></a><span id="showerror" name="showerror" style="color:red;display:none;">  *验证码不可为空</span></td></tr><tr><td>            </td><td>            <input id="art_id" type="hidden" value="" /><input style=" width:50px; height:24px; line-height:24px; *line-height:20px;" type="button" id="vote" value="投 票" onclick="javascript:if(document.getElementById('gdcode').value==''){document.getElementById('showerror').style.display='';}else{vote();}" />            </td></tr></tbody></table> </div><div id="msg" style="display:none; padding-top:10px; font-weight:bold; font-size:14px; color:#f00;"></div><script>jQuery("#td_gdcode").html("<img style=\"width:85px;\" id=\"code\" src=\"/special/tee2012/gdcode.html\" onClick=\"javascript:document.getElementById('code').src='/special/tee2012/gdcode.html?dt='+Math.random();return false;\" />");function vote(){var id = parseInt($("#art_id").val());var code = $("#gdcode").val();$("#auth").dialog('destroy');jQuery.post('/special/tee2012/vote.html','art_id='+id+'&gdcode='+code,function(s){$("#msg").text(s.message);$("#code").attr('src','/special/tee2012/gdcode.html?dt='+Math.random());if(s.code=='succ'){$("#auth").dialog('destroy');$("#msg").dialog({title:"友情提示",width:320,bgiframe: true ,modal: true});$("#t_"+id).text(parseInt($("#t_"+id).text())+1);}if(s.code=='fail'){$("#auth").dialog('destroy');$("#msg").dialog({title:"友情提示",width:320,bgiframe: true ,modal: true});}setTimeout(function(){$("#msg").dialog("destroy")},3000);$("#gdcode").val('');},'json');}function do_vote(artid){var artid = parseInt(artid);$("#art_id").val(artid);$("#auth").dialog({title:'请输入验证码进行投票',resizable: false,width:320,height:200,modal: true});}function do_comment(){var desc = $("#description").val();var code = $("#comgdcode").val();jQuery.post('/special/tee2012/comment.html','description='+desc+'&comgdcode='+code,function(s){$("#msg").text(s.message);if(s.code=='succ'){$("#msg").dialog({title:"友情提示",width:320,bgiframe: true ,modal: true});$("#description").val('');$("#comgdcode").val('');}if(s.code=='fail'){$("#msg").dialog({title:"友情提示",width:320,bgiframe: true ,modal: true});$("#comgdcode").val('');}setTimeout(function(){$("#msg").dialog("destroy")},3000);$("#_ck_gdcode").attr('src','/special/tee2012/gdcode.html?key=docomment&dt='+Math.random());},'json');}</script>


原创粉丝点击