ReferenceError:未定义getRandomInt,第12行(错误代码:-991)运行此脚本时出现此错误
var macro;
macro ="CODE:";
macro +="VERSION BUILD=8601111 RECORDER=FX"+"\n";
macro +="TAB T=1"+"\n";
macro +="TAB CLOSEALLOTHERS"+"\n";
macro +="URL GOTO={{link}}"+"\n";
var link=["www.google.com","www.youtube.com","www.yahoo.com"];
var random=getRandomInt(1,3);
random--;
iimSet("link",link[random])
iimPlay(macro)
答案 0 :(得分:0)
试试这个:
// ...
var random = Math.floor(Math.random()*link.length)
iimSet("link",link[random])
iimPlay(macro)
答案 1 :(得分:0)
由于数组索引从0开始,因此需要一个0到2之间的数字
var random = Math.random() * 2;
iimSet("link",link[random])
iimPlay(macro)
OR
var random = Math.floor((Math.random() * 2));
iimSet("link",link[random])
iimPlay(macro)