How can I make this function loop with javascript? -
function argstoarray(args) { var r = []; (var = 0; < args.length; i++) r.push(args[i]); return r; } argstoarray(document.getelementsbytagname('img')).foreach(function(img) { img.src = img.src.split('vtlibolte8ycb').join('x0x810d0' + math.floor((math.random()*10)+1));; });
i tried adding setinterval(argstoarray,500); @ end seem have broken things.
this quite archaic , crash browser, experiment might work.
function reloadpage() { location.reload(); } setinterval(reloadpage,.5);
i assume using native
foreach
you're targeting ie9+, instead of manually pushing collection contents array just:function argstoarray(args) { return array.prototype.slice.call(args) }
the rest of code looks workable, maybe there's wrong
split()
orjoin()
arguments. please explain trying achieve here.adding
setinterval(argstoarray,500)
call first function without arguments, should use anonymous function or pass arguments setinterval/settimeout function (see mdn).
Comments
Post a Comment