for(var u = 1; u <= 33; u++) {
if(s.indexOf(FR.remoteEvaluate('=INDEXOFARRAY(split(TABLEDATAFIELDS("自选字段"),","),' + u + ')')) >= 0) {
i++;
window.setVisible(true);
window.setVisible(true);
var t = "TEXT" + u;
var r = "LABEL" + u;
$("").css("left", (200 + 300 * ((i - 1) % 3)));
$("").css("top", (90 + 40 * (Math.ceil(i / 3) - 1)));
$("").css("left", (56 + 300 * ((i - 1) % 3)));
$("").css("top", (90 + 40 * (Math.ceil(i / 3) - 1)));
} else {
window.setVisible(false);
window.setVisible(false);
window.reset();
}
}
不用for循环写法
if(s.indexOf(FR.remoteEvaluate('=INDEXOFARRAY(split(TABLEDATAFIELDS("自选字段"),","),1)')) >= 0) {
i++;
t1.setVisible(true);
l1.setVisible(true);
$("").css("left", (200 + 300 * ((i - 1) % 3)));
$("").css("top", (90 + 40 * (Math.ceil(i / 3) - 1)));
$("").css("left", (56 + 300 * ((i - 1) % 3)));
$("").css("top", (90 + 40 * (Math.ceil(i / 3) - 1)));
} else {
t1.setVisible(false);
l1.setVisible(false);
t1.reset();
}
if(s.indexOf(FR.remoteEvaluate('=INDEXOFARRAY(split(TABLEDATAFIELDS("自选字段"),","),2)')) >= 0) {
i++;
t2.setVisible(true);
l2.setVisible(true);
$("").css("left", (200 + 300 * ((i - 1) % 3)));
$("").css("top", (90 + 40 * (Math.ceil(i / 3) - 1)));
$("").css("left", (56 + 300 * ((i - 1) % 3)));
$("").css("top", (90 + 40 * (Math.ceil(i / 3) - 1)));
} else {
t2.setVisible(false);
l2.setVisible(false);
t2.reset();
}
..........
请问是啥问题啊 js如何优化啊
编辑于 2018-8-10 16:52
编辑于 2018-8-10 16:53
编辑于 2018-8-10 17:02
编辑于 2018-8-10 17:02