Javascript 从文本框访问数据

Javascript 从文本框访问数据,javascript,Javascript,我想从名为“cipherTextBox”和“indexCharacterTextBox”的文本框中获取值,然后在函数decryptMessage中使用这些值,然后在文本框“plainTextBox”中显示结果。它不起作用,但我想知道是不是因为我的函数解密消息错了。起作用 您的解密消息函数可能有问题。我们需要看到这一点。是的,看起来您的函数是错误的。你能把它寄出去吗? function testTask06() { var cipherText = document.getElementB

我想从名为“cipherTextBox”和“indexCharacterTextBox”的文本框中获取值,然后在函数decryptMessage中使用这些值,然后在文本框“plainTextBox”中显示结果。它不起作用,但我想知道是不是因为我的函数解密消息错了。

起作用


您的
解密消息
函数可能有问题。我们需要看到这一点。

是的,看起来您的函数是错误的。你能把它寄出去吗?
function testTask06()
{
    var cipherText = document.getElementById('cipherTextBox').value;
    var indexCharacter = document.getElementById('indexCharacterTextBox').value;
    document.getElementById('plainTextBox').value = (decryptMessage(cipherText, indexCharacter, plainArray, cipherArray));
}
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);