Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i have captcha code bout i need to delete o &0 in javascript captcha code and don't sensitive uppercase and lowercase
please guide me?
thanks
Posted
Comments
Member 11686005 1-Sep-15 7:45am    
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Captcha</title>
<script type="text/javascript">
/* Function to Generat Captcha */
function GenerateCaptcha() {
//var chr1 = Math.ceil(Math.random() *10) + '';
//var chr2 = Math.ceil(Math.random() * 10) + '';
//var chr3 = Math.ceil(Math.random() * 10) + '';

var str = new Array(4).join().replace(/(.|$)/g, function () { return ((Math.random() * 36) | 0).toString(36)[Math.random() < .5 ? "toString" : "toLowerCase" ](); });
var captchaCode = str + chr1 + ' ' + chr2 + ' ' + chr3;
document.getElementById("txtCaptcha").value = captchaCode
}

/* Validating Captcha Function */
function ValidCaptcha() {
var str1 = removeSpaces(document.getElementById('txtCaptcha').value);
var str2 = removeSpaces(document.getElementById('txtCompare').value);

if (str1 == str2) return true;
return false;
}

/* Remove spaces from Captcha Code */
function removeSpaces(string) {
return string.split(' ').join('');
}
</script>
</head>
<body >
<div style="border: 2px solid gray; width: 700px;">

Generating Captcha Demo



Enter the Captcha Text:
<input type="text" id="txtCompare" />
<input type="text" id="txtCaptcha" style="text-align: center; border: 2px dashed red; background-image:url(captcha/1.jpg) font-weight: bold; font-size: 20px; font-family: Modern" />
<input type="button" id="btnrefresh" value="Refresh" />
<input id="btnValid" type="button" value="Check" />

<br />
<br />
</div>
</body>
</html>
Sergey Alexandrovich Kryukov 1-Sep-15 9:20am    
Please, all code, properly formatted, in the body of the question, using "Improve question".
—SA
Member 11686005 1-Sep-15 14:42pm    
I send all code to read and help me.?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900