This is because you will just be doing one replace after the other on the one string. For example if you had the string "ABC" and replaced "A" with "B" and then "B" with "C" you will just end up with "CCC" rather than the "BCC" you were after.
To overcome this you will have to put the changes into a new variable. This code should help with what you need (using what you have written).
code:
var alpha = "abcdefghijklmnopqrstuvwxyz";
var code = "ypltavkrezgmshubxncdijfqow";
var Split = Message.split("");
var eSplit = new Array();
for(i=0;i<Split.length;i++){
for(j=0;j<alpha.length;j++){
if(Split[i] == alpha.charAt(j)){
eSplit[i] = code.charAt(j);
break;
}
if(j == alpha.length){
eSplit[i] = Split[i];
}
}
}
var eMessage = eSplit.join("");
Debug.Trace(eMessage);
I hope this extract helps you.
EDIT: Forgot to pass other characters, all fixed now though.