Implement WEB page New message real-time reminder __web

Source: Internet
Author: User
Tags button type set time
1.

Reprint Address: http://blog.sina.com.cn/s/blog_62cd5a980101bn0n.html

During the development of the application system, often to use the reminder of new messages, such as database data updates or a new task for a user to release, then the user should be timely processing reminders, that this function is the simplest amount of real time through the page refresh, access to the database and then inform users have new messages, But this way although simple, but the flaw is also obvious, is the page needs to constantly refresh the server, causing the server burden is too heavy, at the same time the user experience is not good, today bloggers introduced the way is to use Ajax, is one-step JavaScript and XML to request the server to achieve the purpose of the hint, Here the blogger's goal is to display the number of new tasks in the title bar, flashing the title bar,

1, ready, where the blogger uses an AJAX control, Ajaxpro, download, and then in the. NET project, add references (skipped);

Download Address: http://ishare.iask.sina.com.cn/f/37352626.html

2, modify Web.config. Add the following code (add location Needless to say, skip):

>add verb= "Post,get" path= "Ajaxpro/*.ashx" type= "ajaxpro.ajaxhandlerfactory, ajaxpro.2"/>

3. In the Page_Load method in the background file of the page where you want to use reminders, add the following:

AjaxPro.Utility.RegisterTypeForAjax (typeof (_default)); The red content is the name of the class in which the method is located;

4, add front desk JS to use the background method, add the method and you write the common background method is the same, but, need to precede the method with [Ajaxpro.ajaxmethod], otherwise the front desk JS is not access to the method you add;

Other steps to view the blog in the reprinted URLExample of 2.JS timing window and timing reminders (reprint URL: http://www.jbxue.com/article/8791.html)Example 2, timed to close the page or regularly remind <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> close the page regularly or remind-www.jbxue.com</title> regularly
<?import namespace=t implementation= "#default #time2"/>
</HEAD>
<body topmargin=12 Onload=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= two tigers. wmv Mute=true clipbegin=23.8 dur=4 Begin=alt.click-/>
<DIV>
<t:par repeatcount=indefinite>
<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><form name=ff><dd> Please set time to turn off foliage <br> or timing reminders:<br>
<input id=hh onmouseover=select () style=border-right=0 size=1 value=23><q id=input><input style=width= 9 value=:
Disabled><input id=mm onmouseover=select () size=1 value=01><input style=width=9 value=: disabled></ Q><input id=ss onmouseover=select () style=border-left=0 size=1 value=00><br>
The <button hidefocus onclick= ' tips.innerhtml= ' window will be in ' +ff. Hh.value+ ":" +ff. Mm.value+ ":" +ff. ss.value+ "Auto close ..."; SetInterval ("If" clock (FF. Hh.value,ff. Mm.value,ff. Ss.value) Window.close () ", 1) ' > set off </button>
<button hidefocus onclick= ' 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) ' > Set reminder </button>
<button type=reset> 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 ()-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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.