-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.js
More file actions
28 lines (24 loc) · 843 Bytes
/
main.js
File metadata and controls
28 lines (24 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function ChangeCaptcha() {
var chars = "12345679ACEFGHIJKLMNOPQRSTUVWXYZ";
var string_length = 4;
var ChangeCaptcha = '';
var max= chars.length -1;
var min=0;
for (var i=0; i<string_length; i++)
{
var random = Math.floor(Math.random() * (+max - +min) + +min);
ChangeCaptcha = ChangeCaptcha + chars.substring(random,random+1); // single character is selected from the string
}
document.getElementById('randomfield').value = ChangeCaptcha;
}
function check()
{ // Function which checks if the entered value is matching the Captcha
if(document.getElementById('CaptchaEnter').value == document.getElementById('randomfield').value )
{
window.open('https://www.google.co.in','_self');
}
else
{
alert('Please re-check the captcha');
}
}