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.
精彩评论