【发布时间】:2018-11-10 22:47:10
【问题描述】:
我创建了一个在 imacros 上运行的脚本来更新 Firefox 上响应式设计模式的分辨率,但是在脚本选择随机值之后,没有提取正确的数组值。
你能帮我解决吗,我需要添加随机数组的结果。
这是代码
myheight = new Array();
myheight.push("1000");
myheight.push("1100");
myheight.push("1200");
randomint = Math.floor(Math.random()*myheight.length);
iimSet("height",myheight[randomint]);
mywidth = new Array();
mywidth.push("800");
mywidth.push("900");
mywidth.push("1000");
randomint = Math.floor(Math.random()*mywidth.length);
iimSet("width",mywidth[randomint]);
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref("devtools.responsiveUI.customHeight", "height");
prefs.setCharPref("devtools.responsiveUI.customWidth", "width");
此脚本必须更新提取的值,但不能正确提取值。
【问题讨论】:
标签: javascript firefox var imacros