<%@ Page Lang ge="C#" AutoEventWireup="tr" CodeFile="Index.aspx.cs" Inherits="Finance_Index" %>
<!DOCTYPE html P LIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<link href="../CSS/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<iframe id="main" name="main" frameborder="0" style="width:100%; height:100%" src="requireconfirm.aspx"></iframe>
</div>
<div id="MessageContent">
<div class="title">您有新的短消息!<span class="MessageClose" onclick="tips_pop()">X</span></div>
<div class="content" id="content"></div>
</div>
</form>
</body>
</html>
<script type="text/javascript">
var title=document.title;
var state=0;
document.getElementById('MessageContent').style.height='0px';
var MsgPop=document.getElementById("MessageContent");
MsgPop.style.display='none';
if (window.ActiveXObject){xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
else if (window.XMLHttpReqst){xmlHttp = new XMLHttpReqst;} //如果不是ie
init();
function init(){
window.setInterval('CheckInfo()',5000);//每隔5秒自动调用Checkmail()
}
function CheckInfo()
{
xmlHttp.open("POST", "../Reqst/GetMessage.aspx?Type=0&State=1", false); //财务
xmlHttp.send(null);
updatePage();
}
function updatePage() {
if(xmlHttp.readyState==4)// 判断对象状态,readyState=4,说明交互已经完成
{
if(xmlHttp.status==200) //信息已经成功返回,开始处理信息
{
var getresult=xmlHttp.responseXML.getElementsByTagName("span")[0].firstChild.data;
try{
if(state== parseInt(getresult)){
if(state==0){
MsgPop.style.display=='none';
}
else{
if (MsgPop.style.display!="none"){
tips_pop();//隐藏
}
}
}
else{
if (getresult<=state){
document.title=title;
MsgPop.style.display=='none';
}else{
state=getresult;
document.title=title+'(共有'+state+'信息处理)';
document.getElementById('content').innerHTML='共有'+state+'信息处理';
setTimeout("tips_pop()",800); //显示
}
}
}catch(err){
alert('error');
}
}
else if(xmlHttp.status == 404)
{
alert("文件未找到!");
}
else
{ //页面不正常
alert( "\您\所\请\求\的\页\面\有\异\常\。!\n " + xmlhttp.statusText);
}
}
}
//弹出消息
function tips_pop(){
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("MessageContent");
var popH=parseInt(MsgPop.style.height);
if(str=="up"){
if (popH<=80){
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"; //隐藏DIV
}
}
}
</script>
评论