aa

function timeBuckets(){
var html = '<select name=\'time\'>';
var arr =[]; //'00:00--00:30','00:30--01:00'
for(var i=0;i<24;i++){
arr[2*i] = checknum(i)+':00--'+checknum(i)+':30';
arr[2*i+1] = checknum(i)+':30--'+checknum(i+1)+':00';
html+='<option>'+arr[2*i]+'</option>'
+ '<option>'+arr[2*i+1]+'</option>';
}
return html;

// var today = new Date();
// today.setHours(0,0,0);
// for(var i=0;i<48;i++){
// today.setMinutes(today.getMinutes()+30);
// console.log(checktime(today.getHours()) +' '+checktime(today.getMinutes()));
// }
// for(var i=0;i<24;i++){
// //console.log(checknum(i));
// for(var j=0;j<=30;j+=30){
// //console.log(checknum(j));
// console.log(checknum(i)+':'+checknum(j));
// }
// }


}

function checknum(i){
if(i<10){
i = '0'+i;
}
return i;
}

posted @ 2014-07-09 17:42  Western Journey  阅读(161)  评论(0编辑  收藏  举报