The problem is that when i'm sending the output to a textbox,I'm getting an "undefined " message followed by the correct output. Can anyone help me how to get rid of the "undefined" message that is sent to the output text box.
Thanks in advance.
The javascript code is below:
function encrypt(){
var te= new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
var encrypt=new Array('W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','w','x','y','z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v');
var str=document.getElementById("input").value;
var l=str.length;
var i,j;
var en,strde;
for(i=0;i<l;i++)
{
for(j=0;j<54;j++)
{
if( te[j] == (str.charAt(i)) )
{
en = en + encrypt[j];
}
document.getElementById("output").value=en;
}
}
}

New Topic/Question
Reply



MultiQuote



|