Simple Javascript Captcha

<!DOCTYPE html>
<html>
<head>
<title></title>
<script type=”text/javascript”>
var a = Math.ceil(Math.random() * 10);
var b = Math.ceil(Math.random() * 10);
var c = a + b;
function imageCaptcha(){
document.write(‘Berapakah ‘ + a + ” + ” + b + “?”);
document.write(‘<input id=”jawaban” type=”text” maxlength=”2″ size=”2″ />’);
}
function cekJawaban(){
var d = document.getElementById(‘jawaban’).value;
if(d == c) return true;
return false;
windows
}
</script>
</head>
<body>
Apakah anda manusia?
<script type=”text/javascript”>imageCaptcha()</script>
<input type=”button” value=”Check” onclick=”alert(cekJawaban())” name=””>
</body>
</html>

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *