我有以下代码(请耐心等待,我根本不是 Javascript 程序员)
我已经能够加载相关的文本文件,但无法将它们转换为数组,有人可以解释一下吗?
function Login(form) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
USRFile = fso.OpenTextFile("C:\\Users.txt", 1, false, 0);
var USR_LIST = USRFile.Read(1000)
var USRitems = USR_LIST.split(",");
USRFile.Close();
fso = null;
var fso = new ActiveXObject("Scripting.FileSystemObject");
PWDFile = fso.OpenTextFile("C:\\passwords.txt", 1, false, 0);
var PWD_LIST = PWDFile.Read(1000)
var PWDitems = PWD_LIST.split(",");
PWDFile.Close();
fso = null;
username = new Array(USRitems);
password = new Array(PWDitems);
page = "SETTINGS.html";
if (form.username.value == username[0] && form.password.value == password[0] || form.username.value == username[1] && form.password.value == password[1] || form.username.value == username[2] && form.password.value == password[2] || form.username.value == username[3] && form.password.value == password[3] || form.username.value == username[4] && form.password.value == password[4] || form.username.value == username[5] && form.password.value == password[5] || form.username.value == username[6] && form.password.value == password[6] || form.username.value == username[7] && form.password.value == password[7] || form.username.value == username[8] && form.password.value == password[8] || form.username.value == username[9] && form.password.value == password[9]) {
self.location.href = page;
}
else {
page = "Access_Violation.html";
self.location.href = page;
form.username.focus();
}
return true;
}
我在文本 Password.txt 文件中有以下内容
"p1","p2","p3"
对于 User.txt 我有
"u1","u2","u3"
我只是无法获得数组???