繁体   English   中英

带循环的Javascript pdf填充下拉列表

[英]Javascript pdf fill dropdown list with Loop

我想用一个for循环将名为“ mondayHours”的Dropdownlist填充为1到12的数字,有人可以帮助我吗? 我在网上阅读了一些文章,但找不到正确的解决方案。

我已经开始...

for(i=0; i <= 10; i++){
    this.getField("mondayHours").setItems([i.toString()]);
}

但是什么也没发生。

当我使用它时,它的创建下拉项为0.25-...

this.getField("mondayHours").setItems(["0.25","0.5","1","1.25"....]);

使用类似我下面的内容...

var hours = [] // an empty array
for(i=1; i <= 12; i++){
    hours.push(i); // add each number to the end of the array
}

this.getField("mondayHours").setItems(hours); // set the items list to the array

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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