Created
April 22, 2015 08:52
-
-
Save szilardhuber/3971bfc2cd8f17b6333f to your computer and use it in GitHub Desktop.
Javascript PIN checker for Kadosa :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<form onsubmit="return formSubmitted()"> | |
<label for="pin">Pin code</label> | |
<input id="pin" type="password" onkeypress="return inputChange()"/> | |
<input type="submit"/> | |
</form> | |
<script type="text/javascript" src="./index.js"></script> | |
<script type="text/javascript" src="./index2.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var userPIN = 2345; | |
function formSubmitted() { | |
var enteredPIN = parseInt(document.getElementById("pin").value); | |
if (enteredPIN > 0 && enteredPIN < 9999) { | |
if (enteredPIN == userPIN) { | |
alert("This PIN is valid"); | |
return true; | |
} | |
else { | |
alert("This is not your PIN"); | |
return false; | |
} | |
} | |
alert("Please enter valid PIN"); | |
return false; | |
} | |
function inputChange() { | |
var content = document.getElementById("pin").value; | |
return content.length < 4; | |
} | |
function cica() { | |
return 42; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(cica()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment