简体   繁体   中英

How to run function with for-loop in console?

a website only shows some links after clicking on some buttons, but you can trigger these buttons using the js-console of Chrome

Command:

expandPack('S151')

Basicalls the only thing that Changes to get the other Links is the number (in the example 151)

So how can i use a for loop to get all links with the ids 1-300

Thanks

Jackyyy

A standard loop...

for (var i = 1; i <= 300; i++) {
    expandPack("S" + i);
}

Are you saying you want to do this:

for(var i = 1; i <= 300; i += 1) {
    expandPack('S' + i);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM