I got an issue in javascript loops. I am creating a chrome extension and even i have implement it. first i wanted to run a loop in having gap I did that but now i have an another issue and it drives me crazy. I have some Classes And I want to tell my loops that if a class has style in code then skips it from loops and move on to another. my code is. I want the loops in Time and i want it to skip those class which has style. or if it's not possible then yes i want it to skips those class which has area-pressed= true. Here is my code. :D
<html> <head> <script>
function nothing(){
var inputs= document.getElementsByClassName('checking');
var get= document.getElementsByClassName('nothing').style;
function doSetTimeout(i) {
setTimeout(function() { inputs[i].click(); }, i*1000);
}
for (var i=0; i<inputs.length;i++)
if ( get == null) {
doSetTimeout(i);
}
}
</script>
</head>
<body>
<button onclick="nothing()"> Hey </button>
<a href="#" class="checking" area-pressed="false"> Nothing </a>
<a href="1" class="checking" style="noting"> Nothing </a>
<a href="3" class="checking" style=""> Nothing </a>
<a href="4" class="checking" area-pressed="true"> Nothing </a>
<a href="5" class="checking" area-pressed="false"> Nothing </a>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire