打开新窗口关闭当前页面不弹出关闭提示js代码

复制代码 代码如下:

  <script type="text/javascript">

  function closeIt() {

  window.opener = '';

  window.open('http://www.baidu.com');

  window.open('', '_self');

  window.close();

  }

  self.setInterval("newTime()", 1000)

  var t = 4;

  function newTime() {

  if (t > 0) {

  t = t - 1;

  document.getElementById("txtTime").value = t

  }

  else if (t <= 0) {

  closeIt();

  }

  else {

  closeIt();

  }

  }

  </script>