登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

回忆之旅

我很向往山村的农庄生活,他们的热情,让我无法抗拒! 51EOO.COM

 
 
 

日志

 
 

xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");定时刷新提醒  

2010-06-24 18:08:31|  分类: 技术分享 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
<%@ 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>


xmlHttp = new ActiveXObject(Microsoft.XMLHTTP);定时刷新提醒 - Tony - 回忆之旅
  评论这张
 
阅读(922)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018