How to create Capcha Code using java Script-
Code to create Capcha Code given Below:
<script language="javascript">
var a = Math.ceil(Math.random() * 9) + '';
var b = Math.ceil(Math.random() * 9) + '';
var c = Math.ceil(Math.random() * 9) + '';
var d = Math.ceil(Math.random() * 9) + '';
var e = Math.ceil(Math.random() * 9) + '';
var f = Math.ceil(Math.random() * 9) + '';
var g = Math.ceil(Math.random() * 9) + '';
var h = Math.ceil(Math.random() * 9) + '';
var code = a + b + c + d + e + f + g + h;
document.getElementById("numcode").value = code;
function ValidCaptcha() {
var str1 = removeSpaces(document.getElementById('numcode').value);
var str2 = removeSpaces(document.getElementById('txtInput').value);
if (str1 == str2) {
return true;
alert(str1);
} else {
return false;
}
}
function removeSpaces(string) {
return string.split(' ').join('');
}
Enjoy!
Good Luck!
thats pointless :D The capcha is to prevent automated requests (bots) to the server. your code will just ask the real user but never the "bad guy"
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit