i wrote a javascript awhile back, but i want to place it into visual basic *5*. i will post the script below, could someone please translate/convert it for me or point me to a converter i could use? thanks a *lot* in advance!
==========================
========
the script:
<script language="JavaScript">
len=0;
function CalcKey()
{
len=0;
var temp=document.Encrypt.Key.
value;
for(i=0;i<temp.length;i++)
{
len=len+temp.charCodeAt(i)
;
}
if(len==0)
{
alert('Please Enter the appropriate Key');
document.Encrypt.Key.focus
();
}
return len;
}
function Encryption()
{
CalcKey();
document.Encrypt.Encrypted
.value="";
var txt=document.Encrypt.norma
l.value;
var net="";
var fin=0;
if(len>0)
{
if(txt.length>0)
{
for(i=0;i<txt.length;i++)
{
fin=txt.charCodeAt(i)+len;
if(fin>99)
{
net=net+fin;
}
else
{
net=net+'0'+fin;
}
}
document.Encrypt.Encrypted
.value=net
;
document.Encrypt.normal.va
lue="";
}
else
{
alert('Please Enter the Text to be Encrypted');
document.Encrypt.normal.fo
cus();
}
}
}
function Decryption()
{
var txt=document.Encrypt.Encry
pted.value
;
var j=3;
var temp1;
var res="";
CalcKey();
if(len>0)
{
if(txt.length>0)
{
for(i=0;i<txt.length;i+=3)
{
var temp=txt.substring(i,j);
temp1=(parseInt(temp)-len)
;
var t=unescape('%'+temp1.toStr
ing(16));
if(t=='%d' || t=='%a')
{
res=res+' ';
}
else
{
res=res+t
}
j+=3;
}
document.Encrypt.normal.va
lue=res;
document.Encrypt.Encrypted
.value="";
}
else
{
alert('Please Enter the Encrypted Text');
document.Encrypt.Encrypted
.focus();
}
}
}
</script>
==========================
========
the script is then called by the following line of code:
<input type="button" value="Encrypt" onclick="Encryption()">&nb
sp;<input
type="button" value="Decrypt" onclick="Decryption()">&nb
sp;<input
type="reset" value="Reset">
and the three fields that supply the information are key, normal and Encrypted. the key is a 6 digit number, normal is the text NOT encrypted, and Encrypted is the encryted text....
==========================
========
once again, thanks alot in advance, i hope someone can help me...
Start Free Trial