thewebiphyer
09-26-2012, 05:17 PM
:confused:
in this code "words" is the name of an an array so "wdslast" is the final value of the array after it is scrambled (the length of which will also be random). each value in the array is an html string. what have here is my attempt to use the 32nd character from the html string and then every 48th character after that and then combine all the collected characters into one string and assign that string as the value of a variable... help??
var words = question.sort(function() {return 0.75 - Math.random()});
var finval = words.length; var wdslast = words[finval]; var count = wdslast.match(/img/g).length;
var incr = 0;
function increase() {incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;i ncr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;inc r++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr+ +;incr++;incr++;incr++;incr++;incr++;}
var idst = wdslast.substr(32,1);
while (count > 1){
increase();
var idval = idst + wdslast.substr(incr, 1); /*this part i think is my problem because I can't seem to figure out how to add the value of 'idst' to 'idval' only once and then continue as I mentioned above*/
}
in this code "words" is the name of an an array so "wdslast" is the final value of the array after it is scrambled (the length of which will also be random). each value in the array is an html string. what have here is my attempt to use the 32nd character from the html string and then every 48th character after that and then combine all the collected characters into one string and assign that string as the value of a variable... help??
var words = question.sort(function() {return 0.75 - Math.random()});
var finval = words.length; var wdslast = words[finval]; var count = wdslast.match(/img/g).length;
var incr = 0;
function increase() {incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;i ncr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;inc r++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr++;incr+ +;incr++;incr++;incr++;incr++;incr++;}
var idst = wdslast.substr(32,1);
while (count > 1){
increase();
var idval = idst + wdslast.substr(incr, 1); /*this part i think is my problem because I can't seem to figure out how to add the value of 'idst' to 'idval' only once and then continue as I mentioned above*/
}