开发者

Accessing data from text box

开发者 https://www.devze.com 2023-03-07 10:51 出处:网络
function testTask06() { var cipherText = document.getElementById(\'cipherTextBox\').value; var indexCharacter = document.getElementById(\'indexCharacterTextBox\').value;
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

精彩评论

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