//获取弹框
<script>
function tips_pop(){ var MsgPop=document.getElementById("winpop"); var popH=parseInt(MsgPop.style.height); if (popH==0){ MsgPop.style.display="block"; show=setInterval("changeH('up')",2); } else { hide=setInterval("changeH('down')",2); } } function changeH(str) { var MsgPop=document.getElementById("winpop"); var popH=parseInt(MsgPop.style.height); if(str=="up"){ if (popH<=100){ MsgPop.style.height=(popH+4).toString()+"px"; } else{ clearInterval(show); } } if(str=="down"){ if (popH>=4){ MsgPop.style.height=(popH-4).toString()+"px"; } else{ clearInterval(hide); MsgPop.style.display="none"; } } } window.onload=function(){ document.getElementById('winpop').style.height='0px'; setTimeout("tips_pop()",800); }</script>
//div内容和刷新新消息
<div id="winpop">
<div class="title">您有新的消息<span class="close" onclick="tips_pop()">×</span></div>
<div id="notifications">
</div>
//获取消息提醒状态值function winpop(){ var state = '0'; $.get("${ctx}/sys/msgUser/getMsgUserType?state="+state+"&t="+new Date().getTime(), function(data){ $("#notifications").html(data); }); }winpop();//定时刷新获取最新未读消息setInterval(function(){ $("#winpop").load(winpop(),"");}, 10000);