Hey guys,
Can someone take a quick look at this and tell me what’s wrong?
It creates a random code, like ‘poi4gjs’. Once to code is there, I pass it to a php script I wrote for machine unreadable image verification ( you know the ones ).
I keep getting an error on line 22, which is my first array.
I was under the impression that Javscript 1.2, you can set the array directly.
[CODE]
function randCode(){
//create random 7 character code with 1 number in the middle
var arrCode = [‘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 arrNums = [0,1,2,3,4,5,6,7,8,9];
for(i=0; i < 7; i++){
var t = Math.floor(Math.random()*arrCode.length);
var tcode += arrCode[t];
};
t = Math.floor(Math.random()*arrNums.length);
//add a random number to the middle of the code
var code = tcode.substr(0,3) + arrNums[t] + tcode.substr(4);
return code;
};
thanks