日期:2014-05-16 浏览次数:20718 次
///十秒 function StopButton(){ document.getElementById(arguments[0]).disabled=true; document.getElementById(arguments[0]).value="提交("+arguments[1]+")"; if(--arguments[1]>0){ window.setTimeout("StopButton('"+arguments[0]+"',"+arguments[1]+")",1000); } if(arguments[1]<=0){ document.getElementById(arguments[0]).value='提交'; document.getElementById(arguments[0]).disabled=false; } } ///从服务器获取数据 添加到$('#comment') function GetComment($ID,$Page){ $.ajax({ url:"Comment.aspx?action=ajax_getcomment&id="+$ID+"&page="+$Page+"&time"+new Date().toString(), type:'GET', success:function(){ $('#comment').html(arguments[0]); } }); } function SendComment() { //取值 var $CommentParentID =arguments[0];//??不知道什么意思 var $CommentUser =$('#CommentUser').val(); var $CommentText =$('#CommentText').val(); var $CommentValidate = $('#CommentValidate').val(); ///判断 if ($.trim($CommentUser)=='') { alert('请您填写昵称!'); $('#CommentUser').focus(); return false; } if ($.trim($CommentValidate)=='') { alert('请您填写验证码!'); $('#CommentValidate').focus(); return false; } if ($.trim($CommentText)=='') { alert('请您填写回复内容!'); $('#CommentText').focus(); return false; } if ($CommentText.length<5||$CommentText.length>300) { alert('内容必须在5-300字之间!'); return false; } ///执行按钮 StopButton('CommentSubmit', 10); //ajax $.ajax({ url:"Comment.aspx?action=ajax_sendcomment&commentparentid="+$CommentParentID+"&commentuser="+escape($CommentUser)+"&commenttext="+escape($CommentText)+"&commentvalidate="+escape($CommentValidate)+"&time="+new Date().toString(), type:'GET', success:function(){ if (arguments[0]=='ERROR') { alert('验证码出错!'); }else{ GetComment($CommentParentID,1); alert(arguments[0]); $("#CommentText").val(""); //验证成功时,刷新验证码图片 $("#CommentValidateImages").attr("src","VerifyCode.aspx?s="+Math.random()); } $("#CommentValidate").val(""); } }); //SetCookie("CommentUser",$CommentUser,3); }
public partial class Comment : System.Web.UI.Page { string action = string.Empty; string id = string.Empty; string page = string.Empty; string pagehtml = string.Empty; string linkhtml = string.Empty; int Pages = 5; string commentparentid = string.Empty; string commentuser = string.Empty; string commenttext = string.Empty; string commentvalidate = string.Empty; public Comment() { // // TODO: 在此处添加构造函数逻辑 // } protected void Page_Load(object sender, EventArgs e) { action = Request.Params["action"]; id = Request.Params["id"]; page = Request.Params["page"]; commentparentid =