开发者

Accessing data from text box

function testTask06()
{
    var cipherText = document.getElementById('cipherTextBox').value;
    var indexCharacter = document.getElementById('indexCharacterTextBox').value;
    document.getElementById('plainTextBox').value = (decryptMessage(cipherText, indexCharacter, plainArray, cipherArray));
}

I want to get values from textbox called 'cipherTextBox' and 'indexCharacterTextBox', then use those values in my function decryptMessage and then display result in textbox '开发者_高级运维plainTextBox'. It doesnt work but i'm wondering if it's because my function decryptMessage is wrong.


This basic example works

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);

There's probably something wrong with your decryptMessage function. We need to see that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜