var majorId = 0; var time = new Date(); var t='' $(function() { window.onload = function() { setInterval(function() { var time = new Date(); // 程序计时的月从0开始取值后+1 var month = time.getMonth() + 1; var minutes = time.getMinutes(); var seconds = time.getSeconds(); var hours = time.getHours(); if(minutes<10){ minutes ="0" + minutes }else{ minutes } if(seconds<10){ seconds ="0" + seconds }else{ seconds } t = time.getFullYear() + "-" + month + "-" + time.getDate() + "-" + hours + ":" + minutes + ":" + seconds; var str = '

当前时间:' + t + '

' $('#time').html(str) }, 1000); }; $('#start').on('click',function(){ var arr = '

实验开始时间:' + t + '

' $('#start_time').html(arr) }) $('#end').on('click',function(){ var arr = '

实验结束时间:' + t + '

' $('#end_time').html(arr) }) //配置实验信息 实验名称 function getexperiment_name() { layui.use(["form", "table", "laypage", "layer"], function() { var form = layui.form fetchJSON("api/experiment/listAll", {}, "get", function(bet) { if (bet.status === 0) { $("#experiment_name").empty(); $("#experiment_name").append($("