所以我有这样的东西,但它只是在它的末尾输出1的链接。
var pagelink = "http://www.roblox.com/catalog/browse.aspx?CatalogContext=1&Subcategory=2&Keyword=&CurrencyType=0&pxMin=0&pxMax=0&SortType=4&SortAggregation=3&SortCurrency=0&PageNumber=";
var num = 1;
var maxnum = 32;
for(var i = num; i <= maxnum; i++){
pagelink + num
}
所以输出才会返回:
http://www.roblox.com/catalog/browse.aspx?CatalogContext=1&Subcategory=2&Keyword=&CurrencyType=0&pxMin=0&pxMax=0&SortType=4&SortAggregation=3&SortCurrency=0&PageNumber=1
答案 0 :(得分:0)
首先 - 你需要做一些js训练。查看eloquentjavascript.net并前往城镇。
答案:
var pagelink = "http://www.roblox.com/catalog/browse.aspx?CatalogContext=1&Subcategory=2&Keyword=&CurrencyType=0&pxMin=0&pxMax=0&SortType=4&SortAggregation=3&SortCurrency=0&PageNumber=";
var num = 1;
var maxnum = 32;
// You need something to put the output in. Here's an array.
var links = [];
for(var i = num; i <= maxnum; i++) {
links.push(pagelink + i);
}
return links;
答案 1 :(得分:-1)
var pagelink = "http://www.roblox.com/catalog/browse.aspx?CatalogContext=1&Subcategory=2&Keyword=&CurrencyType=0&pxMin=0&pxMax=0&SortType=4&SortAggregation=3&SortCurrency=0&PageNumber=";
var results = [];
for(var i = 0; i <= **however many links you want**; i++){
results.push(pagelink + (i % 32 + 1));
}
results // or if you want it delimited, results.join('\n') or whatever other delimiter you want
您的结果将存储在结果中,您可以将其返回(如果在函数中)或将其用于您需要的结果