1
我創建了驗證碼驗證程序,但它覆蓋了驗證整個表單並提交它的Dreamweaver Spry驗證程序。我如何獲得它以追加到Spry驗證器或與Spry驗證器一起工作。驗證碼驗證程序如下。我不希望它提交表單。我希望它繼續進行驗證整個表單的Spry驗證器。驗證碼驗證問題
function checkform(theform){
var why = "";
if(theform.txtInput.value == ""){
why += "- Security code should not be empty.\n";
}
if(theform.txtInput.value != ""){
if(ValidCaptcha(theform.txtInput.value) == false){
why += "- Security code did not match.\n";
}
}
if(why != ""){
alert(why);
return false;
}
}
// Validate the Entered input aganist the generated security code function
function ValidCaptcha(){
var str1 = removeSpaces(document.getElementById('txtCaptcha').value);
var str2 = removeSpaces(document.getElementById('txtInput').value);
if (str1 == str2){
return true;
}else{
return false;
}
}
// Remove the spaces from the entered and generated code
function removeSpaces(string){
return string.split(' ').join('');
}