This is a program where I have to encrypt a String to ASCII and then decrypt it back to String. I'm almost done and this is what I have so far:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">

<script type="text/javascript">
//This is the function that encrypts...
function thisFunction() {
        var firstMessage = document.thisForm.clearText0.value;
	var someString = firstMessage;
	var j;
	for(j = 0; j < someString.length; j++) {
                var thisArray=new Array();
	        document.thisForm.clearText.value += thisArray[j] = someString.charCodeAt(j) + " ";

//This is the function that is supposed to decrypt...
function thisFunction2() {
        var secondMessage = document.thisForm.clearText.value;
        var thisArray2 = new Array(secondMessage);
        for(var i = 0; i < thisArray2.length; i++) {
            document.thisForm.clearText2.value += thisArray2[i] = String.fromCharCode(i);



<form name="thisForm">
Message to be encrypted...
<textarea rows="6" cols="30" name="clearText0"></textarea>
<input type="button" value="Encrypt" onclick="thisFunction()"/>
<textarea rows="6" cols="30" name="clearText"></textarea>
<input type="button" value="Decrypt" onclick="thisFunction2()"/>
<textarea rows="6" cols="30" name="clearText2"></textarea>
The encryption works perfectly but the decryption doesn't ouput anything. What could be wrong?