ASP高手帮忙删除留言版中的验证码功能
发布网友
发布时间:2024-10-18 13:05
我来回答
共1个回答
热心网友
时间:2024-10-18 20:01
去掉:
book.htm页面的
<div id="nc2"><div id="ncbj3"> 验证码:</div> <input type="text" class="blur postvalidate" id="CommentValidate" onFocus="this.className='focus postvalidate'" onBlur="this.className='blur postvalidate'" maxlength="4" />
<img src="about:blank" alt="验证码" name="CommentValidateImages" align="absbottom" id='CommentValidateImages' style="cursor:pointer;height:20px;width:80px;" title="看不清楚?换一张" onClick="src='Code.asp?s='+Math.random()" onerror="this.onerror=null;this.src='Code.asp?s='+Math.random();" /></div>
plu.js
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;
}
}
function GetComment($ID,$Page){
$.ajax({
url:"Comment.asp?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>200)
{
alert('内容必须在5-200字之间!');
return false;
}
StopButton('CommentSubmit',10);
$.ajax({
//url:"Comment.asp?action=ajax_sendcomment&commentparentid="+$CommentParentID+"&commentuser="+escape($CommentUser)+"&commenttext="+escape($CommentText)+"&commentvalidate="+escape($CommentValidate)+"&time="+new Date().toString(),
url:"Comment.asp?action=ajax_sendcomment&commentparentid="+$CommentParentID+"&commentuser="+escape($CommentUser)+"&commenttext="+escape($CommentText)+"&time="+new Date().toString(),
type:'GET',
success:function(){
// if (arguments[0]=='ERROR')
// {
// alert('验证码出错!');
// }else{
GetComment($CommentParentID,0);
// alert(arguments[0]);
// $("#CommentText").val("");
//验证成功时,刷新验证码图片
// $("#CommentValidateImages").attr("src","Code.asp?s="+Math.random());
// }
// $("#CommentValidate").val("");
}
});
//SetCookie("CommentUser",$CommentUser,3);
}
Comment.asp修改最后一个过程。
Function ajax_sendcomment()
Dim commentparentid, commentuser, commenttext ', commentvalidate
OpenConn(DbPath)
commentparentid = Request.QueryString("commentparentid")
commentuser = unescape(Request.QueryString("commentuser"))
commenttext = unescape(Request.QueryString("commenttext"))
'commentvalidate = unescape(Request.QueryString("commentvalidate"))
' If CStr(session("GetCode"))<>commentvalidate Then
' Echo ("ERROR")
' Response.End()
' Else
Sql = "insert into comment(commentparentid,commentuser,commenttext,commentreply,commentip) values('"&commentparentid&"','"&commentuser&"','"&Server.HTMLEncode(commenttext)&"','','"&GetIP()&"')"
Set Rs = Conn.Execute(Sql)
CloseRs()
CloseConn()
Echo ("评论发表成功.")
' End If
End Function