鍍金池/ 問答/HTML/ mobiscroll怎么在onClose:function(textVale,i

mobiscroll怎么在onClose:function(textVale,inst){}中修改input中顯示的時間值

代碼如下:在線等待

$(function () {
    var myDate = new Date();
    var y = myDate.getFullYear();
    var m = myDate.getMonth();
    var d = myDate.getDate();
    var h = myDate.getHours();
    var f = myDate.getMinutes()+150;

    if(h>23){
        d = d+1;
    }
    if(h < 6){
        h = 6;
        f = 30 + 150;
    }


    var newjavascript={
        plugdatetime:function ($dateTxt,type) {
            //var curr = new Date().getFullYear();
            var opt = {}
            opt.time = {preset : type};
            opt.date = {preset : type};
            opt.datetime = {
                preset : type,
                minDate: new Date(y,m,d,h,f),
                maxDate: new Date(y,m,d+1,19,00),
                stepMinute: 15
            };

            $dateTxt.val('').scroller('destroy').scroller($.extend(opt[type], {
                    theme: "android-ics light",
                    mode: "scroller",
                    display: "bottom",
                    lang: "zh",
                    yearText: "年",
                    monthText: "月",
                    dayText: "日",
                    hourText: "時",
                    minuteText: "分",
                    timeWheels: 'HHii',//24小時
                    timeFormat: 'HH:ii',
                    setText: '確定',
                    cancelText: '取消',
                    dateFormat: 'yy-mm-dd',
                    onClose:function(textVale,inst){ //插件效果退出時執(zhí)行 inst:表示點擊的狀態(tài)反饋:set/cancel
                        var nowTime = textVale.substring(11,textVale.length);
                        var nows = nowTime.split(":");
                        var nowH = parseInt(nows[0]);
                        var nowF = parseInt(nows[1]);
                        if(nowH >= 0 && nowH<6){
                            alert("請選擇0點到6點30之外的時間。");
//想在此處把input中的時間改成另外一個時間值
                        }else if(nowH == 6){
                            if(nowF<30){
                                alert("請選擇0點到6點30之外的時間。");
//想在此處把input中的時間改成另外一個時間值
                            }
                        }
                    }

                })
            );
        }
    }
    newjavascript.plugdatetime($("#ps_time"), "datetime")
});
回答
編輯回答
初心
2018年3月11日 12:57
編輯回答
尐飯團

clipboard.png

https://www.mobiscroll.cn/app...

文檔里不是有嗎?

2017年10月3日 16:57