初学javascript,找了一些小游戏玩,觉得还不错,
代码如下
[JavaScript] 纯文本查看 复制代码 function checkPass(password) {
var total = 0;
var charlist = "abcdefghijklmnopqrstuvwxyz";
for (var i = 0; i < password.length; i++) {
var countone = password.charAt(i);
var counttwo = (charlist.indexOf(countone));
counttwo++;
total *= 17;
total += counttwo;
}
if (total == 248410397744610) {
setTimeout(
"location.replace('index.php?password=" + password + "' ) ; ", 0)
} else {
alert(
"Sorry, but the password was incorrect.");
}
}
给出正确答案 gctkyo 的一半{:soso_e113:}
如果有小伙伴解不出的话,再给出解题代码,
提示:目测不出来,用javascript解决,如果位置有两种可能优先考虑大位置 |