我的JavaScript弹出脚本无法在IE上运行

时间:2012-08-21 00:22:03

标签: javascript popup

这是我关闭弹出窗口后重定向到某个页面的脚本...它在chrome和firefox上运行得很好,但在Internet Explorer上却不行!

<script language="JavaScript" type="text/javascript"> 
var ty = 0;

 function getsome(){
 ty = ty +1;

 }

var my_window = null;

function wopen2(url, name, w, h, scrolling, resizable)
{

// Fudge factors for window decoration space.

  w += 17;
  h += 87;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;

 // IE5 and other old browsers might allow a window that is
 // partially offscreen or wider than the screen. Fix that.
 // (Newer browsers fix this for us, but let's be thorough.)


 if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }

   my_window = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=' + scrolling + ', resizable=' + resizable);

  // Just in case width and height are ignored

 my_window.resizeTo(w, h);


//my_window.resizeTo(120, 122);
// Just in case left and top are ignored

  my_window.moveTo(wleft, wtop);
 my_window.focus();
  timer();
}

 function timer(){
 if(ty == 1){
  setTimeout( "check_func()" , 1000);
  }
 }

  function check_func() {

  if(false == my_window.closed){
   timer()

  }else{
  window.location = video.htm';
  }


}


</script>

0 个答案:

没有答案