我想从checkCaptcha2()
函数返回到我从checkCaptcha1()
调用validate2()
函数的位置。
function validate2(){
var flag="true";
if(checkCaptcha1()){ //<<----- I want to return back here from checkCaptcha2() function
document.getElementById("captcha").innerHTML = "CAPTCHA Validation
Failed ! Try Again";
flag="false";
}
if(flag=="true"){
return true;
}
else{
return false;
}
}
function checkCaptcha1(){
//alert(document.signupform.recaptcha_response_field.value.trim());
var recaptcha_challenge_field = document.signupform.recaptcha_challenge_field.value.trim();
//alert(recaptcha_challenge_field);
var recaptcha_response_field = document.signupform.recaptcha_response_field.value.trim();
//alert(recaptcha_response_field);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request");
return false;
}
var url="../ajax/checkCaptcha.jsp";
url=url+"?recaptcha_challenge_field="+recaptcha_challenge_field+"&"+"recaptcha_response_field="+recaptcha_response_field;
xmlHttp.onreadystatechange=checkCaptcha2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
return;
}
function checkCaptcha2(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var showdata = xmlHttp.responseText;
var str = showdata.split("#$");
if(str[1]=="fail"){
return false;
}
else{
return true;
}
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{**strong text**
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
I want to return back from checkCaptcha2()
从我checkCaptcha1()
调用validate2()
函数的函数。请提出一些想法。
不能写那里的更多细节
没有关于我的更多细节
问题