标签:time stat site if判断 lang hdf func val +=
比如消除实验室考试的那个5分钟点一次的功能
<script language="JavaScript"> var secondsInit = 1; var hdflag = 0; var login_flag = "1"; var site_url = ""; function _fresh() { secondsInit ++; var seconds = secondsInit; var result = ‘‘; if (seconds >= 3600) { var h = Math.floor(seconds / 3600); result += h + "小时"; seconds -= 3600 * h; } if (seconds >= 60) { var m = Math.floor(seconds / 60); result += m + "分"; seconds -= 60 * m; } result += seconds + "秒"; document.getElementById(‘_lefttime‘).innerHTML = result; if((hdflag % 60)==0){ $.post(site_url+"/exam_xuexi_online.php", { "cmd":‘xuexi_online‘ }, function (data) { data = eval(‘(‘+data+‘)‘); if(data.status==1){ $(‘#xuexi_online‘).html(data.shichang); } }); } if(hdflag>240){ hdflag = 0; } hdflag ++; } if(login_flag){ _fresh() setInterval(_fresh,1000); } </script>
改之前if判断那块本来是: if(hdflag > 300){ if(....()){ 输出...... } }
标签:time stat site if判断 lang hdf func val +=
原文地址:https://www.cnblogs.com/CongG/p/12028941.html