日期:2014-05-16  浏览次数:20355 次

求JS高手,把下面的JS改成兼容IE,火狐和Goolge浏览器
//------GetMessageCount.js Begin----------------------
var oPopup = window.createPopup();
var popTop=20;
var foc;
var b_con = "",b_flag=true;
var CurrentWinisActive=false;

window.onfocus = function() {
  CurrentWinisActive = true;
  if(b_flag==false){
  oPopup.show(screen.width-265,screen.height,241,178);
  }
}

window.onblur = function() {
  CurrentWinisActive = false;
  if(b_flag==false){
  oPopup.show(screen.width-265,screen.height,241,178);
  }
}


function set_content(content){
  var winstr="<table style=\"border: 1 solid #03A8F6;font-size:12px; background:#cfdef4;\" width=\"241px\" height=\"172px\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >";
  winstr+="<tr><td height=\"30\" style=\" border-bottom:1px solid #03A8F6;color: red;\">&nbsp;新消息</td>";
  winstr+="<td align=\"right\" style=\" border-bottom:1px solid #03A8F6;\"><span id=close onclick=\"parent.close();\" style=\"cursor:pointer;\">[关闭]</span>&nbsp;</td>";
  winstr+="</tr><tr><td colspan=\"2\" style=\"padding:5px 0 0 5px;\" align=\"left\"><div style=\"overflow-y:auto; height:140px;\">"+content+"<div></td></tr>";
  winstr+="<tr><td colspan=\"2\" style=\"display:none;\">";
  winstr+="<object id=\"Player\" width=\"0px\" height=\"0px\" type=\"application/x-oleobject\" border=\"0\" classid=\"CLSid:6BF52A52-394A-11d3-B153-00C04F79FAA6\">";
  winstr+="<param name=\"URL\" value=\"/images/system.mp3\" /><param name=\"AutoStart\" value=\"true\" hidden=\"true\" /></OBJECT>";
  winstr+="</td></tr>"
  winstr+="</table>";
  return winstr;
}
function popmsg(content){
  b_flag = false;
oPopup.document.body.innerHTML = set_content(content);
popshow();
}
function popshow(){  
window.status="您有新消息(提示15秒后自动关闭)";

  if(popTop<180){
  popTop+=10;
  oPopup.show(screen.width-265,screen.height,241,popTop);
  }
  else{
clearTimeout(mytime);
focusWin();
window.status="";
return;
  }  
  var mytime=setTimeout("popshow();",50);
}
function close(){
  b_flag=true;
  popTop = 180;
  clearTimeout(foc);
  pophide();
}
function pophide(){
  if(popTop>0){
  popTop-=10;
  oPopup.show(screen.width-265,screen.height,241,popTop);
  }
  else{
clearTimeout(mytime);
oPopup.hide();
return;
  }
  var mytime=setTimeout("pophide();",50);
}
function focusWin()
{
  if(CurrentWinisActive==true){
  oPopup.show(screen.width-265,screen.height,241,178);
foc = setTimeout("focusWin();",50);
  }
}

if(!GetMessageCount){
  var GetMessageCount = {};
}

$(document).ready(
  function(){
  GetMessageCount.FindMessage();
  }