1.
转载地址:http://blog.sina.com.cn/s/blog_62cd5a980101bn0n.html
在应用系统的开发过程中,经常要使用到新消息的提醒功能,比如说数据库数据有更新或者对某个用户有新的任务下达,这时就要对用户进行及时的处理提醒,那这个功能最简单额实现就是通过页面实时刷新,访问数据库然后告知用户有新的消息,但是这种方式虽然简单,但是缺陷也是显而易见的,就是页面需要不停的刷新服务器,造成服务器负担太重,同时用户体验也不好,今天博主介绍的方式是使用Ajax,就是一步的javascript和xml来请求服务器来达到提示的目的,这里博主的目标是在标题栏显示新的任务的条数,同时闪动标题栏,
1、准备,这里博主使用到一个Ajax控件,AjaxPro,下载,然后在.net项目中,添加引用之(跳过);
下载地址:http://ishare.iask.sina.com.cn/f/37352626.html
2、修改Web.config.添加以下代码(具体添加位置不用说了吧,跳过):
>add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
3、在需要使用提醒的页面的后台文件中的page_load方法中,添加以下内容:
AjaxPro.Utility.RegisterTypeForAjax(typeof(_default));红色内容是该方法所在的类的名称;
4、添加前台js要嗲用的后台方法,添加的方法和你写普通的后台方法是一样的,只不过,需要在该方法前面加上 [AjaxPro.AjaxMethod],否则前台js是访问不到你添加的方法的;
其他步骤查看转载网址里的博客
2.JS定时关闭窗口及定时提醒效果的例子(转载网址:http://www.jbxue.com/article/8791.html)
<HEAD>
<STYLE>v\:*{behavior:url(#default#vml)}
v\:oval,#oDiv{position=absolute;width=200;height=200}
#stay{position=absolute;top=70;left=59;color=RED;padding=6;font=900 20/1.3}
#input input{border-left=0;border-right=0}
</STYLE>
<TITLE>定时关闭页面或定时提醒-www.jbxue.com</TITLE>
<hta:application border=none scroll=0 innerBorder=ridge>
<?import namespace=t implementation="#default#time2"/>
</HEAD>
<BODY topmargin=12 resizeTo(220,240),moveTo(200,5)>
<v:oval fillcolor=#8F strokecolor=gray strokeweight=3 />
<t:par onrepeat=alt.click() repeatcount=indefinite>
<t:TRANSITIONFILTER TYPE="clockWipe" dur=60 TARGETELEMENT="oDiv"/>
<DIV ID="oDiv" DUR=60>
<v:oval fillcolor=#FF0 strokecolor=RED strokeweight=2 />
</DIV></t:par>
<a href=# id=alt></a><U id=stay unselectable=on></U>
<t:ref id=ref style=width=200;height=200 src=两只老虎.wmv mute=true clipBegin=23.8 dur=4 begin=alt.click />
<DIV>
<t:par repeatCount=indefinite>
<HR align=left id=hr0 color=TEAL width=200 size=14>
<hr onpropertychange="per=parseInt(100*offsetWidth/hr0.offsetWidth),len.innerHTML=(per>9?'':'_')+per+'%'" style=position=absolute;top=219;height=expression(hr0.size) color=BLUE id=hr dur=60>
<t:animate targetElement=hr attributeName=width id=hran from=0></t:par>
Loading persent: <a id=len style=color=red;font=800></a> .</DIV>
<dl><dt><h4>定时关闭叶面或则定时提醒:</h4>
<form name=FF><dd>请设置定时关闭叶面<br>或则定时提醒的时间:<br>
<input id=HH οnmοuseοver=select() style=border-right=0 size=1 value=23><q id=input><input style=width=9 value=:
disabled><input id=MM οnmοuseοver=select() size=1 value=01><input style=width=9 value=: disabled></q><input id=SS οnmοuseοver=select() style=border-left=0 size=1 value=00><br>
<button hideFocus οnclick='tips.innerHTML="窗口将于 "+FF.HH.value+":"+FF.MM.value+":"+FF.SS.value+"自动关闭...";setInterval("if(clock(FF.HH.value,FF.MM.value,FF.SS.value))window.close()",1)'>设定关闭</button><img width=5 height=1>
<button hideFocus οnclick='setInterval("if(clock(FF.HH.value,FF.MM.value,FF.SS.value)){ref.mute=false;ref.dur=30;alt.click()}",1);
setInterval("if(clock(FF.HH.value,(FF.MM.value*1+1),FF.SS.value)){ref.mute=true;ref.dur=3;alt.click()}",1)'>设定提醒</button><img width=5 height=1>
<button type=reset>重新设定</button><br>
<span id=tips style='background=lightyellow'></span></dl>
</form>
<script>
hran.dur=hr.dur,hran.to=hr0.width
int=new Date(),B='<br>'
setInterval("stay.innerHTML=String(int).slice(-22,-13).fontcolor(1)+B+String(new Date(new Date()-int-288e5)).split(/ /)[3]+B+Date().slice(-13,-5).fontcolor()",1e3)
function clock(hh,mm,ss){with(new Date()) return new Date()-new Date(getYear(),getMonth(),getDate(),hh*1,mm*1,ss*1+1)==0}
</script>
</BODY>
</HTML>
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow