function testTask06()
{
var cipherText = document.getElementById('cipherTextBox').value;
var indexCharacter = document.getElementById('indexCharacterTextBox').value;
document.getElementById('plainTextBox').value = (decryptMessage(cipherText, indexCharacter, plainArray, cipherArray));
}
我想从文本框中获取名为'cipherTextBox'和'indexCharacterTextBox'的值,然后在我的函数decryptMessage中使用这些值,然后在textbox'plainTextBox'中显示结果。它不起作用,但我想知道是否因为我的函数decryptMessage是错误的。
答案 0 :(得分:2)
function foo() {
var cipherText = document.getElementById('cipherTextBox').value;
var indexCharacter = document.getElementById('indexCharacterTextBox').value;
document.getElementById('plainTextBox').value =
decryptMessage(cipherText, indexCharacter, [], []);
}
function decryptMessage(a, b) {
// dummy function
return a + b;
}
document.getElementById("button").addEventListener("click", foo, false);
您的decryptMessage
功能可能有问题。我们需要看到这一点。