<body>
<div id="block">
...
<div class="section" id="section-%number%">
</div>
...
</div>
</body>
var makingColumsInterval = setTimeout(function rekurs(){
if(randNumbersArray.length === columQty){
clearTimeout(makingColumsInterval);
}
var randomNum = getRandomNum(1, columQty);
if(randNumbersArray.indexOf(randomNum) === -1) {
randNumbersArray.push(randomNum);
outputNumbers("section-" + randNumbersArray[randNumbersArray.length - 1]);
}
var makingColumsInterval = (rekurs(),100);
},100);
if(randNumbersArray.length === columQty){
clearTimeout(makingColumsInterval);
}
makingColumnsInterval = setInterval(function (){
if(randNumbersArray.length === columQty){
clearInterval(makingColumnsInterval);
return;
}
var randomNum = getRandomNum(1, columQty);
if(randNumbersArray.indexOf(randomNum) === -1) {
randNumbersArray.push(randomNum);
outputNumbers("section-" + randNumbersArray[randNumbersArray.length - 1]);
}
}, 100);
el.addEventListener('click', handler, false);
el.addEventListener('click', handler, true);
el.removeEventListener('click', handler);
el.removeEventListener('click', handler);
el.removeEventListener('click', handler, false);
el.removeEventListener('click', handler, true);
obj = { 'key': [ 1, 2, 3, 4, 5 ], 0: 'somevalue', 1: 564}
keys = Object.keys(obj)
for (var i = 0, l1 = keys.length; i < l1; i++) {
if ( isNaN(parseInt(keys[i])) ) {
for (var j = 0, arr = obj[keys[i]], l2 = arr.length; j < l2; j++) {
console.log(arr[j]);
}
}
}
function on(arg, function_to_apply) {
if (Array.ifArray(arg)) {
for (i = 0; i < arg.length; i++ ) {
function_to_apply( arg[i] );
}
} else {
function_to_apply( arg );
}
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
var elements = document.getElementsByClassName("asd"),
length_of_elements = elements.length,
setContent = function(){
this.innerHTML = 'lol';
}, i;
for (i=0;i<length_of_elements;i++) {
elements[i].addEventListener('click',setContent,false);
}
В данный момент наверное нет реально работающих сервисов способных такое сделать.