PDA

View Full Version : Turning Code into CharCode


krunchy11
01-03-2005, 07:08 AM
I use this function a fair bit mainly to hide my code from scriptkiddies. I know experienced javascript users can get what it means easily but they can write their own code too.

function gencode(strings)
{
var string1 = strings
var stringlen = string1.length - 1
var total
for (x=0;x<=stringlen;x++)
{
if (x==0)
{
total = string1.charCodeAt(x)
}
else
{
total = total + "," + string1.charCodeAt(x)
}
}
return total
}

this code then gives back a delimited string of numbers.
then to use it I use the eval command

eval(Script.fromCharCode(*This is where your number array goes*))


I konw its simple but I made it cause I had use for it some of you may too.

Regards
K.F