簡體   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