2016-11-09 46 views
0
页面

我使用IE 11和Chrome 54上的JScript ...定时器功能不能在IE 11使用工作顶点

我有如下代码在浏览器上显示一个计时器,它适用于Chrome,但IE浏览器不?

var display; 
    function startTimer(duration, display) { 
     var timer = duration, minutes, seconds; 
     setInterval(function() { 
      minutes = parseInt(timer/60, 10) 
      seconds = parseInt(timer % 60, 10); 

      minutes = minutes < 10 ? "0" + minutes : minutes; 
      seconds = seconds < 10 ? "0" + seconds : seconds; 

      display.textContent = minutes + ":" + seconds; 

      if (--timer <= 0) { 
       do_func(); // something 
       timer = duration; 
      } 
     }, 1000); 
    }; 

    window.onload = function() { 
     var tenMinutes = 60 * 1; 
     display = document.querySelector('.time'); 
     startTimer(tenMinutes, display); 
    }; 

我在oracle顶点网页(HTML文本)型区域如下

本次会议将在数分钟内关闭上显示它。请在会话结束前保存你的工作!

+0

在Apex页面显示为此会话将在分钟。请在会话关闭之前保存你的工作!
user7136163

+1

你在控制台中得到的错误信息是什么?这应该有助于缩小它的范围 – Dymos

+0

error IE console:Object不支持属性或方法'querySelector' – user7136163

回答

0

我尝试作为

$(function ($) { 
    var fifteenMinutes = 60 * 15, 
     display = $('#time'); 
    startTimer(fifteenMinutes, display); 
}); 

,而不是

window.onload = function() { 
     var tenMinutes = 60 * 15; 
     display = document.querySelector('.time'); 
     startTimer(tenMinutes, display); 
    }; 

,并正在Chrome和IE11。 谢谢