如果我将itemlist1更改为itemlist2自动转移到列表2示例,我需要VB6,ComboBox的代码
combo1.listindex
01 item list 1
02 item list 2
...等
itemlist1
Apple
Orange
itemlist2
Book
CD desk
答案 0 :(得分:2)
希望我做对了。组合1包含“项目列表1”和“项目列表2”。如果我选择“项目列表1”,则在combo2中填充“Apple,Orange”,如果我选择“项目列表2”,则在combo2中填充“Book,CD desk”。以下是代码。
function getNumberOfWeekDays(start, end, dayNum){
// Sunday's num is 0 with Date.prototype.getDay.
dayNum = dayNum || 0;
// Calculate the number of days between start and end.
var daysInInterval = Math.ceil((end.getTime() - start.getTime()) / (1000 * 3600 * 24));
// Calculate the nb of days before the next target day (e.g. next Sunday after start).
var toNextTargetDay = (7 + dayNum - start.getDay()) % 7;
// Calculate the number of days from the first target day to the end.
var daysFromFirstTargetDay = Math.max(daysInInterval - toNextTargetDay, 0);
// Calculate the number of weeks (even partial) from the first target day to the end.
return Math.ceil(daysFromFirstTargetDay / 7);
}
var start = new Date("2016-05-25");
var finish = new Date("2016-05-31");
console.log("Start:", start);
console.log("Start's week day num:", start.getDay());
console.log("Finish:", finish);
console.log("Finish's week day num:", finish.getDay());
console.log("Number of Sundays:", getNumberOfWeekDays(start, finish));