感谢群里的KB同学,好基友一辈子
1 window.onbeforeunload = function(){ 2 var b; 3 if(!b){ 4 t = setTimeout("jump()",150); 5 } 6 return "确定要离开这鸟页面?"; 7 }; 8 9 function jump(){ 10 window.onbeforeunload = null; 11 location.href = "http://www.baidu.com/"; 12 b = true;//解决IE下的BUG 13 }