<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_彬彬的博客</title><subtitle type="text">Asp.net（C#)开发,Android开发！</subtitle><id>http://feed.cnblogs.com/blog/u/76349/rss</id><updated>2012-02-21T14:51:39Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/76349/rss"/><entry><id>http://www.cnblogs.com/fly_binbin/archive/2012/02/07/2341773.html</id><title type="text">关Activity的Launch mode</title><summary type="text">在Android中，每个Activity有4种LaunchMode，默认是standard，下面对这四种模式进行实例验证加深理解。设计两个Activity，分别称为A，B，每个Activity上面都放置两个按钮，一个启动A，一个启动B。界面如下：（上面的一行文字用来识别是在A界面还是在B界面）在代码中实现onCreate()：Java代码ButtonbtnA=(Button)findViewById(R.id.btnA);btnA.setOnClickListener(newOnClickListener(){publicvoidonClick(Viewv){//TODOAuto-genera</summary><published>2012-02-07T09:50:00Z</published><updated>2012-02-07T09:50:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2012/02/07/2341773.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2012/02/07/2341773.html"/><content type="html">&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;在Android中，每个Activity有4种LaunchMode，默认是standard，下面对这四种模式进行实例验证加深理解。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;设计两个Activity，分别称为A，B，每个Activity上面都放置两个按钮，一个启动A，一个启动B。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;界面如下：（上面的一行文字用来识别是在A界面还是在B界面）&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;img src="http://dl.iteye.com/upload/attachment/423578/8af709a7-2113-35d8-b9fc-781f2de6f951.png" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " alt="" /&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;在代码中实现onCreate()：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;div id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: #ffffff; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25px; text-align: left; "&gt;&lt;div&gt;&lt;div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-weight: bold; "&gt;Java代码&amp;nbsp;&lt;embed wmode="transparent" src="http://mypyg.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=Button%20btnA%20%3D%20(Button)findViewById(R.id.btnA)%3B%0A%09%09btnA.setOnClickListener(new%20OnClickListener()%20%7B%09%09%09%0A%09%09%09public%20void%20onClick(View%20v)%20%7B%0A%09%09%09%09%2F%2F%20TODO%20Auto-generated%20method%20stub%0A%09%09%09%09startActivity(new%20Intent(A.this%2C%20A.class))%3B%0A%09%09%09%7D%0A%09%09%7D)%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20Button%20btnB%20%3D%20(Button)findViewById(R.id.btnB)%3B%0A%20%20%20%20%20%20%20%20btnB.setOnClickListener(new%20OnClickListener()%20%7B%09%09%09%0A%09%09%09public%20void%20onClick(View%20v)%20%7B%0A%09%09%09%09%2F%2F%20TODO%20Auto-generated%20method%20stub%0A%09%09%09%09startActivity(new%20Intent(A.this%2C%20B.class))%3B%0A%09%09%09%7D%0A%09%09%7D)%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20Log.e(%22Task%3A%22%2BgetTaskId()%2C%20%22A%22%20%2B%20mId%20%2B%20%22%20created.%22)%3B%20" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"&gt;&amp;nbsp;&lt;a href="http://mypyg.iteye.com/blog/919643" title="收藏这段代码" style="color: #108ac6; "&gt;&lt;img src="http://mypyg.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; color: #2b91af; "&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;Button&amp;nbsp;btnA&amp;nbsp;=&amp;nbsp;(Button)findViewById(R.id.btnA);&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;btnA.setOnClickListener(&lt;span style="color: #7f0055; "&gt;new&lt;/span&gt;&amp;nbsp;OnClickListener()&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f0055; "&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color: #7f0055; "&gt;void&lt;/span&gt;&amp;nbsp;onClick(View&amp;nbsp;v)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;TODO&amp;nbsp;Auto-generated&amp;nbsp;method&amp;nbsp;stub&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;startActivity(&lt;span style="color: #7f0055; "&gt;new&lt;/span&gt;&amp;nbsp;Intent(A.&lt;span style="color: #7f0055; "&gt;this&lt;/span&gt;,&amp;nbsp;A.&lt;span style="color: #7f0055; "&gt;class&lt;/span&gt;));&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Button&amp;nbsp;btnB&amp;nbsp;=&amp;nbsp;(Button)findViewById(R.id.btnB);&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;btnB.setOnClickListener(&lt;span style="color: #7f0055; "&gt;new&lt;/span&gt;&amp;nbsp;OnClickListener()&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f0055; "&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color: #7f0055; "&gt;void&lt;/span&gt;&amp;nbsp;onClick(View&amp;nbsp;v)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;TODO&amp;nbsp;Auto-generated&amp;nbsp;method&amp;nbsp;stub&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;startActivity(&lt;span style="color: #7f0055; "&gt;new&lt;/span&gt;&amp;nbsp;Intent(A.&lt;span style="color: #7f0055; "&gt;this&lt;/span&gt;,&amp;nbsp;B.&lt;span style="color: #7f0055; "&gt;class&lt;/span&gt;));&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Log.e("Task:"+getTaskId(),&amp;nbsp;"A"&amp;nbsp;+&amp;nbsp;mId&amp;nbsp;+&amp;nbsp;"&amp;nbsp;created.");&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;onNewIntent()：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;div id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: #ffffff; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25px; text-align: left; "&gt;&lt;div&gt;&lt;div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-weight: bold; "&gt;Java代码&amp;nbsp;&lt;embed wmode="transparent" src="http://mypyg.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=Log.e(%22Task%3A%22%2BgetTaskId()%2C%20%22A%22%20%2B%20mId%20%2B%20%22%20onNewIntent.%22)%3B" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"&gt;&amp;nbsp;&lt;a href="http://mypyg.iteye.com/blog/919643" title="收藏这段代码" style="color: #108ac6; "&gt;&lt;img src="http://mypyg.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; color: #2b91af; "&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;Log.e("Task:"+getTaskId(),&amp;nbsp;"A"&amp;nbsp;+&amp;nbsp;mId&amp;nbsp;+&amp;nbsp;"&amp;nbsp;onNewIntent.");&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;onDestroy()：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;div id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: #ffffff; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25px; text-align: left; "&gt;&lt;div&gt;&lt;div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-weight: bold; "&gt;Java代码&amp;nbsp;&lt;embed wmode="transparent" src="http://mypyg.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=Log.e(%22Task%3A%22%2BgetTaskId()%2C%20%22A%22%20%2B%20mId%20%2B%20%22%20destroyed.%22)%3B" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"&gt;&amp;nbsp;&lt;a href="http://mypyg.iteye.com/blog/919643" title="收藏这段代码" style="color: #108ac6; "&gt;&lt;img src="http://mypyg.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; color: #2b91af; "&gt;&lt;li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "&gt;Log.e("Task:"+getTaskId(),&amp;nbsp;"A"&amp;nbsp;+&amp;nbsp;mId&amp;nbsp;+&amp;nbsp;"&amp;nbsp;destroyed.");&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;这样就可以直观的从Logcat输出中看到Activity的创建、销毁以及请求的响应。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="font-size: large; "&gt;1.两个Actiity的LaunchMode都为默认的standard，启动Ap，看到输出：&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): A1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;A被创建了一个实例A1，并且放在了任务9中。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;此时任务栈中内容为：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;A&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;点击界面上启动A的按钮，看到输出：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): A2 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;A再次被创建了一个新的实例A2，仍然放在任务9中。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;此时任务栈中内容为：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;AA&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;点击启动B的按钮，&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): B1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;B被创建一个新的实例B1，仍然放在任务9中。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;此时任务栈内容为：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;AAB&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;再启动B，&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): B2 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;B又被创建了一个新的实例B2，仍然在任务9中。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;任务栈内容为：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;AABB&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;按Back键依次返回桌面，输出依次为：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): B2 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): B1 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): A2 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:9(380): A1 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;任务栈的变化次序为：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;AABB&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;AAB&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;AA&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;A&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;结论：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: red; "&gt;每个Intent，都创建了一个新的Activity来响应，并且Back时是按照弹栈的顺序处理的。&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="font-size: large; "&gt;2.B设置为SingleTop，启动Ap：&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:10(409): A1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;再启动A：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:10(409): A2 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;再启动B：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:10(409): B1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;再启动B：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:10(409): B1 onNewIntent.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: red; "&gt;结论：&amp;nbsp;&lt;br /&gt;当B不在栈顶时，仍然会创建B的新实例。&amp;nbsp;&lt;br /&gt;当B在栈顶时，请求启动B的Intent并没有触发创建B的新实例，而是触发了栈顶B的onNewIntent()&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;按Back键依次返回桌面，输出依次为：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:10(409): B1 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:10(409): A2 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:10(409): A1 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: red; "&gt;结论：&amp;nbsp;&lt;br /&gt;虽然发送了四次Intent，但实际上只创建了3个Activity，所以只有3次销毁输出。&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="font-size: large; "&gt;3.B设置为SingleTask，启动Ap：&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:11(438): A1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;启动B：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:11(438): B1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;启动A：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:11(438): A2 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;启动B：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:11(438): B1 onNewIntent.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:11(438): A2 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: red; "&gt;结论：&amp;nbsp;&lt;br /&gt;当B已经存在时，再次请求B会触发已经存在的B1实例的onNewIntent；&amp;nbsp;&lt;br /&gt;并且如果B所在的任务栈上面有其他Activity，那么其他Activity会被销毁。&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="font-size: large; "&gt;4.B设置为SingleInstance，启动Ap：&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:12(466): A1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;启动B，&lt;/span&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; color: red; "&gt;此时新创建了任务栈13，和先前的A1并不在一个任务。&lt;/span&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:13(466): B1 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;再启动B，没有创建新实例：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:13(466): B1 onNewIntent.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;再启动A，再旧的任务12中创建了A的新实例&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:12(466): A2 created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;按下Back键：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:12(466): A2 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;看输出和前面没区别，但是&lt;/span&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; color: red; "&gt;注意界面，此时不是切换到B界面，因为此时活动任务是12，所以A1被显示了出来&lt;/span&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;再次按下Back键：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;Task:12(466): A1 destroyed.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;p&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;此时因为任务12已经结束，B1所在的任务13成为活动任务，B1的界面才被显示出来。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://daylog-emlog.stor.sinaapp.com/upload/d25e3665c0172f3523b8cdc0e86ffbe820120207095109.zip"&gt;Demo 下载&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;文章来源：&lt;a href="http://mypyg.iteye.com/blog/919643"&gt;http://mypyg.iteye.com/blog/919643&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2341773.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2012/02/07/2341773.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2304125.html</id><title type="text">Jquery 关键字加链接加颜色插件（原创）</title><summary type="text">看到一些网页上面，经常有关键字带着链接和其它的颜色，一直想做一个，今天在网上参考了点资料，感觉要实现关键字加链接，变色，是如此的简单，主要就是使用正则表达式对关键字进行的修改，使用到的JavaScript的函数主要有两个，一个为link另外一个为fontcolor，一个为加链接，一个为加颜色，主要代码如下： return u.fontcolor(keys[u][1]).link(keys[u][0]);Demo 下载</summary><published>2011-12-27T15:07:00Z</published><updated>2011-12-27T15:07:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2304125.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2304125.html"/><content type="html">&lt;div&gt;&lt;p&gt;看到一些网页上面，经常有关键字带着链接和其它的颜色，一直想做一个，今天在网上参考了点资料，感觉要实现关键字加链接，变色，是如此的简单，主要就是使用正则表达式对关键字进行的修改，使用到的JavaScript的函数主要有两个，一个为link另外一个为fontcolor，一个为加链接，一个为加颜色，主要代码如下：&lt;/p&gt;&lt;p&gt;&amp;nbsp; return u.fontcolor(keys[u][1]).link(keys[u][0]);&amp;nbsp;&lt;/p&gt;&lt;p&gt;Demo &lt;a href="http://daylog-emlog.stor.sinaapp.com/upload/b844aec48db1c829db124d05bc2c991920111227150420.rar"&gt;下载&amp;nbsp;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2304125.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2304125.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2303498.html</id><title type="text">动态加载js和css的jquery plugin （Jquery插件）[转]</title><summary type="text">放在javascript文件头部，就像C#（using...）或Java（import ...）$.extend({includePath: '',include: function(file) {var files = typeof file == "string" ? [file]:file;for (var i = 0; i &lt; files.length; i++) {var name = files[i].replace(/^\s|\s$/g, "");var att = name.split('.');va</summary><published>2011-12-27T06:13:00Z</published><updated>2011-12-27T06:13:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2303498.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2303498.html"/><content type="html">&lt;div&gt;&lt;span style="font-family: verdana; font-size: 12px; "&gt;放在javascript文件头部，就像C#（using...）或Java（import ...）&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div&gt;$.extend(&lt;span id="Codehighlighter1_209_950_Open_Text"&gt;{&lt;br /&gt;&amp;nbsp;includePath: '',&lt;br /&gt;&amp;nbsp;include: &lt;span style="color: #0000ff;"&gt;function&lt;/span&gt;(file) &lt;span id="Codehighlighter1_260_948_Open_Text"&gt;{&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; files = &lt;span style="color: #0000ff;"&gt;typeof&lt;/span&gt; file == "string" ? [file]:file;&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; i = 0; i &amp;lt; files.length; i++) &lt;span id="Codehighlighter1_368_942_Open_Text"&gt;{&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; name = files[i].replace(/^\s|\s$/g, "");&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; att = name.split('.');&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; ext = att[att.length - 1].toLowerCase();&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; isCSS = ext == "css";&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; tag = isCSS ? "link" : "script";&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; attr = isCSS ? " type='text/css' rel='stylesheet' " : " language='javascript' type='text/javascript' ";&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;var&lt;/span&gt; link = (isCSS ? "href" : "src") + "='" + $.includePath + name + "'";&lt;br /&gt;&amp;nbsp;&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; ($(tag + "[" + link + "]").length == 0) document.write("&amp;lt;" + tag + attr + link + "&amp;gt;&amp;lt;/" + tag + "&amp;gt;");&lt;br /&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;}&lt;/span&gt;);&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;调用方式&lt;/p&gt;&lt;div&gt;&lt;span style="font-family: 'Courier New'; font-size: 12px; line-height: 18px; background-color: #f5f5f5; "&gt;$.includePath&amp;nbsp;=&amp;nbsp;'JS或者CSS的路径';&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style="background-color: #f5f5f5; font-family: 'Courier New'; font-size: 12px; line-height: 18px; "&gt;$.include(['jquery.tree.js',&amp;nbsp;'jquery.tree.css']);&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;原文地址：&lt;a href="http://www.cnblogs.com/chenjinfa/archive/2009/03/17/1414178.html"&gt;http://www.cnblogs.com/chenjinfa/archive/2009/03/17/1414178.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://daylog.sinaapp.com/?post=19"&gt;下载&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2303498.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/27/2303498.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/24/2300221.html</id><title type="text">Jquery 弹出窗口插件开发-在屏幕固定位置停留[原创]</title><summary type="text">近来做项目，需要使用一个弹出窗口插件，插件要跟随窗口滚动，在网上找了几个插件，始终感觉不尽人意，所以萌生了，自己开发一个的想法，通过一天左右的了解，知道了Jquery开发插件的基本思路，并且也写了几个简单的Demo进行练习，Demo暂时就不上传了，等完成后再上传！ 此开发的基本思路为：生成一组弹出窗口DIV，然后写入到body，最后显示出来，如果弹出窗口中显示的为某个ID或者是Class内的html（）的话，可以将此ID或者是Class写入到生成的DIV元素中，把原来的ID或者Class删除，在关闭的时候，再将此ID或者是Class写到body中，将原来生成的DIV或者是其它元素删除，即可！.</summary><published>2011-12-24T03:17:00Z</published><updated>2011-12-24T03:17:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/24/2300221.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/24/2300221.html"/><content type="html">&lt;div&gt;&lt;p&gt;&amp;nbsp;近来做项目，需要使用一个弹出窗口插件，插件要跟随窗口滚动，在网上找了几个插件，始终感觉不尽人意，所以萌生了，自己开发一个的想法，通过一天左右的了解，知道了Jquery开发插件的基本思路，并且也写了几个简单的Demo进行练习，Demo暂时就不上传了，等完成后再上传！&lt;/p&gt;&lt;br /&gt;  此开发的基本思路为：生成一组弹出窗口DIV，然后写入到body，最后显示出来，如果弹出窗口中显示的为某个ID或者是Class内的html（）的话，可以将此ID或者是Class写入到生成的DIV元素中，把原来的ID或者Class删除，在关闭的时候，再将此ID或者是Class写到body中，将原来生成的DIV或者是其它元素删除，即可！&lt;p&gt;&amp;nbsp;经过几天的修改与调试，第一个Bate版，终于出来了，主要是这是第一次写这样的插件，没有什么经验，边写边学，边学边写，终于能有点成果了，希望对大家有所帮助！&lt;/p&gt;&lt;span style="color: red; font-size: 18pt; "&gt;此弹出窗口，停留在屏幕固定位置，不随屏幕的滚动面滚动，兼容IE6，测试方式为，打开页面后，点击下面的按钮即可出现弹出窗口！&lt;/span&gt;&lt;br /&gt;里面带有源码一压缩后的代码，请在附件中下载&lt;br /&gt;&lt;br /&gt;&lt;a href="http://daylog-emlog.stor.sinaapp.com/upload/3cf38908c725311a7b3c6a176922ad2620111224030933.rar"&gt;Demo&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2300221.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/24/2300221.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/21/2296518.html</id><title type="text">jQuery下扩展插件和拓展函数的写法</title><summary type="text">jQuery，最主要是它的思想“write less,do more"，对于jQuery插件的写法，以前就有介绍过，网上也有很多例子。 这里简要地进行些写法，主要是简写的说明，见下列代码：;(function($) { var minute = 1000 * 60; var hour = minute * 60; var day = hour * 24; var halfamonth = day * 15; var month = day * 30; $.extend({ PIF_dateDiffFor...</summary><published>2011-12-21T15:33:00Z</published><updated>2011-12-21T15:33:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/21/2296518.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/21/2296518.html"/><content type="html">&lt;div&gt;&lt;p&gt;&amp;nbsp;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; background-color: #f7fcff; "&gt;jQuery，最主要是它的思想&amp;#8220;write less,do more"，&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; background-color: #f7fcff; "&gt;对于jQuery插件的写法，以前就有介绍过，网上也有很多例子。 这里简要地进行些写法，主要是简写的说明，见下列代码：&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp;;(function($)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; white-space: pre; "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var minute = 1000 * 60;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var hour = minute * 60;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var day = hour * 24;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var halfamonth = day * 15;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var month = day * 30;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $.extend({ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PIF_dateDiffFormat:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Info:{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Name: "格式化时间差",&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Ver: "1.0.0.0",&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Corp: "fly_binbin",&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Author: "fly_binbin",&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date: "2011-12-17",&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Email:"legend.binbin.fly@gmail.com",&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Copyright: "Copyright @ 2000-2010 fly_binbin Technology Software All Rights Reserved",&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; License: "GPL"&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; getDateDiff: function (varparam) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var dateTimeStamp = varparam ? Date.parse(varparam.replace(/-/gi,"/")) : new Date().getTime();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var now = new Date().getTime();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var diffValue = now - dateTimeStamp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(diffValue &amp;lt; 0){&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;alert("结束日期不能小于开始日期！");&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var monthC =diffValue/month;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var weekC =diffValue/(7*day);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var dayC =diffValue/day;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var hourC =diffValue/hour;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var minC =diffValue/minute;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(monthC &amp;gt;=1){&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; white-space: pre; "&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;return varparam;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if(weekC&amp;gt;=1){&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;result="发表于" + parseInt(weekC) + "个星期前";&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if(dayC&amp;gt;=1){&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result="发表于"+ parseInt(dayC) +"天前";&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if(hourC&amp;gt;=1){&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;result="发表于"+ parseInt(hourC) +"个小时前";&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if(minC&amp;gt;=1){&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result="发表于"+ parseInt(minC) +"分钟前";&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}else&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;result="刚刚发表";&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return result;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },//具有参数的函数对象，这里参数是一个对象，具有属性&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FunctionWithParams:function(paramObj) {&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//使用参数，是否使用默认值&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var params = paramObj ? paramObj : new function(){&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; param1= "1";&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; param2= "2";&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return this.Info.Name + ".FunctionWithParamObject";&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, //具有参数的函数对象，这里参数是一个变量&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FunctionWithParam:function(varparam) {&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//使用参数，是否使用默认值&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var param = varparam ? varparam : null;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return this.Info.Name + ".FunctionWithParam";&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })(jQuery);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-style: inherit; font-family: inherit; vertical-align: baseline; line-height: 25px; "&gt;通过以上方式，就完成了一个最简单的Jquery插件的开发。&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2296518.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/21/2296518.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/19/2293250.html</id><title type="text">Jquery 插件 让IE6支持fixed属性</title><summary type="text">在主题制作或者修改中一些元素要设置为随页面滚动的效果，通常的做法是加上fixed属性，或者干脆用js实现这个功能。基于现在流行的Jquery，制作了这一个Jquery的小插件，用于解决IE6下面的fixed问题，代码如下：/** Ver: "1.0.0.0"* 修正IE6下面的position中的fixed的显示问题* author：fly_binbin* Blog: http://daylog.sinaapp.com* E-Mail:legend.binbin.fly@gmail.com* Copyright: "Copyright @ 211-2012 fly</summary><published>2011-12-19T05:15:00Z</published><updated>2011-12-19T05:15:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/19/2293250.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/19/2293250.html"/><content type="html">&lt;div&gt;&lt;p&gt;&lt;span style="color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; text-indent: 28px; background-color: #f8f8f8; "&gt;在主题制作或者修改中一些元素要设置为随页面滚动的效果，通常的做法是加上fixed属性，或者干脆用js实现这个功能。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #333333; font-family: 宋体; "&gt;&lt;span style="font-size: 14px; line-height: 28px; "&gt;基于现在流行的Jquery，制作了这一个Jquery的小插件，用于解决IE6下面的fixed问题，代码如下：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #333333; font-family: 宋体; "&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;/*&lt;/p&gt;&lt;p&gt;* &amp;nbsp;Ver: "1.0.0.0"&lt;/p&gt;&lt;p&gt;* 修正IE6下面的position中的fixed的显示问题&lt;/p&gt;&lt;p&gt;* &amp;nbsp;author：fly_binbin&lt;/p&gt;&lt;p&gt;* &amp;nbsp;Blog: http://daylog.sinaapp.com&lt;/p&gt;&lt;p&gt;* &amp;nbsp;E-Mail:legend.binbin.fly@gmail.com&lt;/p&gt;&lt;p&gt;* &amp;nbsp;Copyright: "Copyright @ 211-2012 fly_binbin Technology Software All Rights Reserved",&lt;/p&gt;&lt;p&gt;* &amp;nbsp;License: "GPL"&lt;/p&gt;&lt;p&gt;* &amp;nbsp;$("ID Or Clss").ie6fixedbug();&lt;/p&gt;&lt;p&gt;*/&lt;/p&gt;&lt;p&gt;$.fn.extend({&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; ie6fixedbug: function () {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(this).css("position", "absolute");&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var m = (window.screen.height - $(this).height()) / 4;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var obj = $(this)[0];&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window.onscroll = function () {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj.style.top = (document.body.scrollTop || document.documentElement.scrollTop) + m + 'px';&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window.onresize = function () {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj.style.top = (document.body.scrollTop || document.documentElement.scrollTop) + m + 'px';&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;}); &amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;可以下附件中下载此代码：&lt;/p&gt;&lt;p&gt;&lt;a href="http://daylog-emlog.stor.sinaapp.com/upload/3cf38908c725311a7b3c6a176922ad2620111219014925.rar"&gt;下载&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2293250.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/19/2293250.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/17/2291213.html</id><title type="text">Jquery 插件 对时间差进行格式化</title><summary type="text">在一些网站上，常常看到刚发表的留言显示为“刚刚”，时间长一些的，显示为：“几天前”，“几小时前”等等，那么这个怎么来实现呢？我们其实没有必要在数据库中对这些进行格式化，完全可以交给客户端进行显示，网上有许多JS写的，那么现在封闭成了一个Jquery的插件，代码如下：vardateTimeStamp=varparam?Date.parse(varparam.replace(/-/gi,"/")):newDate().getTime();varnow=newDate().getTime();vardiffValue=now-dateTimeStamp;if(diffValue&amp;</summary><published>2011-12-17T09:32:00Z</published><updated>2011-12-17T09:32:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/17/2291213.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/17/2291213.html"/><content type="html">&lt;p&gt;在一些网站上，常常看到刚发表的留言显示为&amp;#8220;刚刚&amp;#8221;，时间长一些的，显示为：&amp;#8220;几天前&amp;#8221;，&amp;#8220;几小时前&amp;#8221;等等，那么这个怎么来实现呢？我们其实没有必要在数据库中对这些进行格式化，完全可以交给客户端进行显示，网上有许多JS写的，那么现在封闭成了一个Jquery的插件，代码如下：&lt;/p&gt;&lt;div style="background-color: #F5F5F5;border: 1px solid #CCCCCC;padding:10px;"&gt;&lt;div&gt;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;dateTimeStamp&amp;nbsp;=&amp;nbsp;varparam&amp;nbsp;?&amp;nbsp;Date.parse(varparam.replace(/-/gi,"/"))&amp;nbsp;:&amp;nbsp;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&amp;nbsp;Date().getTime();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;now&amp;nbsp;=&amp;nbsp;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&amp;nbsp;Date().getTime();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;diffValue&amp;nbsp;=&amp;nbsp;now&amp;nbsp;-&amp;nbsp;dateTimeStamp;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt;(diffValue&amp;nbsp;&amp;lt;&amp;nbsp;0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert("结束日期不能小于开始日期！");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;monthC&amp;nbsp;=diffValue/month;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;weekC&amp;nbsp;=diffValue/(7*day);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;dayC&amp;nbsp;=diffValue/day;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;hourC&amp;nbsp;=diffValue/hour;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;var&lt;/span&gt;&amp;nbsp;minC&amp;nbsp;=diffValue/minute;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt;(monthC&amp;nbsp;&amp;gt;=1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;return&lt;/span&gt;&amp;nbsp;varparam;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;else&lt;/span&gt;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt;(weekC&amp;gt;=1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result="发表于"&amp;nbsp;+&amp;nbsp;parseInt(weekC)&amp;nbsp;+&amp;nbsp;"个星期前";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;else&lt;/span&gt;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt;(dayC&amp;gt;=1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result="发表于"+&amp;nbsp;parseInt(dayC)&amp;nbsp;+"天前";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;else&lt;/span&gt;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt;(hourC&amp;gt;=1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result="发表于"+&amp;nbsp;parseInt(hourC)&amp;nbsp;+"个小时前";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;else&lt;/span&gt;&amp;nbsp;&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt;(minC&amp;gt;=1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result="发表于"+&amp;nbsp;parseInt(minC)&amp;nbsp;+"分钟前";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;span style="color: #0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result="刚刚发表";&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #0000ff; "&gt;return&lt;/span&gt;&amp;nbsp;result;&lt;/p&gt;&lt;p&gt;这是主要的代码，具体文件，可以下载附件：&amp;nbsp;&lt;a title="下载" href="http://files.cnblogs.com/fly_binbin/jquery.dateDiffFormat.js"&gt;下载&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2291213.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/17/2291213.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289756.html</id><title type="text">jQuery对象与DOM对象之间的转换</title><summary type="text">刚开始学习jQuery，可能一时会分不清楚哪些是jQuery对象，哪些是DOM对象。至于DOM对象不多解释，我们接触的太多了，下面重点介绍一下jQuery，以及两者相互间的转换。什么是jQuery对象？---就是通过jQuery包装DOM对象后产生的对象。jQuery对象是jQuery独有的，其可以使用jQuery里的方法。比如：$("#test").html() 意思是指：获取ID为test的元素内的html代码。其中html()是jQuery里的方法这段代码等同于用DOM实现代码：document.getElementById("id").inner</summary><published>2011-12-16T01:31:00Z</published><updated>2011-12-16T01:31:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289756.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289756.html"/><content type="html">&lt;div&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;刚开始学习jQuery，可能一时会分不清楚哪些是jQuery对象，哪些是DOM对象。至于DOM对象不多解释，我们接触的太多了，下面重点介绍一下jQuery，以及两者相互间的转换。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: red; "&gt;什么是jQuery对象？&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;---就是通过jQuery包装DOM对象后产生的对象。jQuery对象是jQuery独有的，其可以使用jQuery里的方法。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;比如：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;$("#test").html()&amp;nbsp;&amp;nbsp; 意思是指：获取ID为test的元素内的html代码。其中html()是jQuery里的方法&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;这段代码等同于用DOM实现代码：&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;document.getElementById("id").innerHTML;&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;虽然jQuery对象是包装DOM对象后产生的，但是jQuery无法使用DOM对象的任何方法，同理DOM对象也不能使用jQuery里的方法.乱使用会报错。比如：$("#test").innerHTML、document.getElementById("id").html()之类的写法都是错误的。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;还有一个要注意的是：用#id作为选择符取得的是jQuery对象与document.getElementById("id")得到的DOM对象，这两者并不等价。请参看如下说的两者间的转换。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;既然jQuery有区别但也有联系，那么jQuery对象与DOM对象也可以相互转换。在再两者转换前首先我们给一个约定：如果一个获取的是jQuery对象，那么我们在变量前面加上$，如：var $variab = jQuery对象；如果获取的是DOM对象，则与习惯普通一样：var variab = DOM对象；这么约定只是便于讲解与区别，实际使用中并不规定。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: red; "&gt;jQuery对象转成DOM对象：&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;两种转换方式将一个jQuery对象转换成DOM对象：[index]和.get(index);&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;(1)jQuery对象是一个数据对象，可以通过[index]的方法，来得到相应的DOM对象。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;如：var $v =$("#v") ; //jQuery对象&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;var v=$v[0];&amp;nbsp;&amp;nbsp;&amp;nbsp; //DOM对象&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;alert(v.checked)&amp;nbsp;&amp;nbsp; //检测这个checkbox是否被选中&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;(2)jQuery本身提供，通过.get(index)方法，得到相应的DOM对象&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;如：var $v=$("#v");&amp;nbsp; //jQuery对象&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;var v=$v.get(0);&amp;nbsp;&amp;nbsp; //DOM对象&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;alert(v.checked)&amp;nbsp; //检测这个checkbox是否被选中&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;strong style="font-weight: bold; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: red; "&gt;DOM对象转成jQuery对象:&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;对于已经是一个DOM对象，只需要用$()把DOM对象包装起来，就可以获得一个jQuery对象了。$(DOM对象)&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;如：var v=document.getElementById("v");&amp;nbsp; //DOM对象&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;var $v=$(v);&amp;nbsp;&amp;nbsp;&amp;nbsp; //jQuery对象&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;转换后，就可以任意使用jQuery的方法了。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;通过以上方法，可以任意的相互转换jQuery对象和DOM对象。需要再强调注意的是：DOM对象才能使用DOM中的方法，jQuery对象是不可以用DOM中的方法。&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2289756.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289756.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289600.html</id><title type="text">html5 简介（来源于网络）</title><summary type="text">HTML5是什么？新特性和新功能介绍Web2.0带来的丰富互联网技术让所有人都享受到了技术发展和体验进步的乐趣。作为下一代互联网标准，HTML5自然也是备受期待和瞩目，技术人员、设计者、互联网爱好者们都在热议HTML5究竟能带来什么。那么就一起来窥探一下这个还未诞生就已经声名在外的新标准吧。 在探讨HTML5的新特性之前，先说HTML5究竟离我们还有多远?用一张时间轴来说明两个关键点。 如图，在2012年，将会由W3C发布候选推荐版，这个版本的发布就代表着HTML5的规范编写已经完成了。而2022年推出的计划推荐版，则意味着至少会有两个浏览器会完全的支持HTML5的所有特性。2022年听起..</summary><published>2011-12-15T16:13:00Z</published><updated>2011-12-15T16:13:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289600.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289600.html"/><content type="html">&lt;div&gt;&lt;p&gt;&lt;strong&gt;HTML5是什么？新特性和新功能介绍&lt;/strong&gt;&lt;/p&gt;&lt;div&gt;&lt;p&gt;Web2.0带来的丰富互联网技术让所有人都享受到了技术发展和体验进步的乐趣。作为下一代互联网标准，HTML5自然也是备受期待和瞩目，技术人员、设计者、互联网爱好者们都在热议HTML5究竟能带来什么。那么就一起来窥探一下这个还未诞生就已经声名在外的新标准吧。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;在探讨HTML5的新特性之前，先说HTML5究竟离我们还有多远?用一张时间轴来说明两个关键点。&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="76" src="http://www.yixieshi.com/uploads/allimg/110714/023T32211-0.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T32211-0.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; " /&gt;&lt;/center&gt;&lt;p&gt;如图，在2012年，将会由W3C发布候选推荐版，这个版本的发布就代表着HTML5的规范编写已经完成了。而2022年推出的计划推荐版，则意味着至少会有两个浏览器会完全的支持HTML5的所有特性。2022年听起来似乎很遥远，但通过观察现阶段chrome, firefox , safari，IE等浏览器对HTML5的支持程度，可以看出各大浏览器厂商都非常积极。应该不需要到2022年就会有至少两个浏览器支持HTML5。因此现在关注和讨论HTML5，了解HTML5的新特性，为以后的产品规划并非毫无意义。&amp;nbsp;互联网的一些事&lt;/p&gt;&lt;p&gt;HTML5其实是关于图像，位置，存储，速度的优化和改进，以下分别论述。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;图像：&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;到目前为止，基本上想要直接在网页上进行绘图还是不能轻易完成的，即使是几何图形也不可以。在浏览器当中直接能跟图片的交互操作也很有限，多数是保存和点击。如果希望能够跟图片进行更多的操作或者在浏览器当中画出图形，就需要flash, silverlight 这类插件来帮忙。&amp;nbsp;互联网的一些事&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="295" src="http://www.yixieshi.com/uploads/allimg/110714/023T3M24-1.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T3M24-1.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;p&gt;HTML5了解人们的需求，HTML5已经确定引入canvas标签，通过canvas，用户将可以动态的生成各种图形图像，图表以及动画。下面是一个示例网站，展示了不通过插件，使用HTML5直接绘制图片有兴趣的朋友可以自己亲自去试玩一下。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="261" src="http://www.yixieshi.com/uploads/allimg/110714/023T311T-2.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T311T-2.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;p&gt;不仅如此，HTML5也赋予图片图形更多的交互可能，HTML5的canvas标签还能够配合javascript来利用键盘控制图形图像，这无疑为现有的网页游戏提供了新的选择和更好的维护性和通用性，脱离了flash插件的网页游戏必然能够获得更大的访问量，更多的用户。一些统计数据表格也可以通过使用canvas标签来达到和用户的交互，例如某网站对2009年德国的大选情况统计就全部通过了HTML5来实现用户点击和数据的变更，点选某个区域就可以实时的看到该区域各党派选票率，大大增强了统计图表的可读性。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="402" src="http://www.yixieshi.com/uploads/allimg/110714/023T36239-3.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T36239-3.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;p&gt;通过HTML5对图形图像的新特性，未来可能会有在线绘图的工具和应用，人们将不再需要安装painter这类基本的绘图软件，而直接使用基于浏览器的应用。而对用户体验人员和开发者来说，将能够在用户毫不知情的情况下收集和生成用户鼠标的浏览轨迹，从而生成一部分可用的热点图，这对于找出网站的不足，提升用户体验有着重要作用。现在对canvas标签的支持情况如下，可以看到，基本所有的浏览器都已经不同程度上支持了这一特性。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="69" src="http://www.yixieshi.com/uploads/allimg/110714/023T33358-4.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T33358-4.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;p&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;位置：&lt;/strong&gt;&amp;nbsp;yixieshi&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="324" src="http://www.yixieshi.com/uploads/allimg/110714/023T35520-5.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T35520-5.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;p&gt;这个大头针图标从2010年到2011年在各类应用和互联网上应该是非常火爆了吧?没错，就是地理位置，各处都可以看到人们在签到，查找自己当前的地理位置和周边。作为新标准的HTML5自然也不会置身事外，HTML5通过提供应用接口&amp;#8212;Geolocation API，在用户允许的情况下共享当前的地理位置信息，并为用户提供其他相关的信息。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;HTML5的Geolocation API主要特点在于：1. 本身不去获取用户的位置，而是通过其他三方接口来获取，例如IP,GPS,WIFI等方式。2. 用户可以随时开启和关闭，在被程序调用时也会首先征得用户同意，保证了用户的隐私。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;存储以及速度：&lt;/strong&gt;&amp;nbsp;互联网的一些事&lt;/p&gt;&lt;p&gt;现在，web应用的火爆已经是不折不扣的现实，并且相对传统的应用,web应用不需要安装，所占空间小的特性使其具备传统软件应用所不具备的优势，然而，目前制约web应用最大的问题在于网络连接不能够无时无处。在飞机上，汽车上，火车上，有很多地方都无法被网络信号所覆盖，因此web应用也就无法使用。&amp;nbsp;互联网的一些事&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="217" src="http://www.yixieshi.com/uploads/allimg/110714/023T31S2-6.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T31S2-6.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;p&gt;HTML5的离线存储使得这个问题迎刃而解。HTML5的web storage API 采用了离线缓存，会生成一个清单文件(manifest file)，这个清单文件实质就是一系列的URL列表文件，这些URL分别指向页面当中的HTML,CSS,Javascrpit,图片等相关内容。当使用离线应用时，应用会引入这一清单文件，浏览器会读取这一文件，下载相应的文件，并将其缓存到本地。使得这些web应用能够脱离网络使用，而用户在离线时的更改也同样会映射到清单文件中，并在重新连线之后将更改返回应用，工作方式与我们现在所使用的网盘有着异曲同工之处。&amp;nbsp;yixieshi&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="600" height="260" src="http://www.yixieshi.com/uploads/allimg/110714/023T33413-7.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T33413-7.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;p&gt;感兴趣的朋友们可以试下这个网站，就属于便携笔记本的离线应用，可以在离线的时候记录一些便签，在下次上线，或使用其他平台登录时，仍然能够看到之前的记录。&amp;nbsp;互联网的一些事&lt;/p&gt;&lt;p&gt;缓存的强大并不止在于离线应用，同样在于对cookies的替代，目前我们经常使用的保存网站密码，使用的就是cookies将密码信息缓存到本地，当需要时再发送至服务器端。然而，cookies有其本身的缺点&amp;#8212;4KB的大小和反复在服务器和本地之间传输，并且无法被加密。对于cookies的反复传输，不仅浪费了使用者的带宽、供应商的服务器的性能，更增加了被泄露的危险。&amp;nbsp;互联网的一些事&lt;/p&gt;&lt;p&gt;Web storage API 解救了cookies, 据现有的资料，web storage API将至少支持4M的空间作为缓存，对于日常的清单文件和基础信息，应该已经足够使用了，毕竟4KB我们不是都使用了这么多年了?速度的提升方式在于，webstorage API 将不再无休止的传输相同的数据给服务器，而只在服务器请求和做出更改时传输变更的必须文件，这样就大大节省了带宽，也减轻了服务器的压力。可谓是一举数得!&amp;nbsp;yixieshi&lt;/p&gt;&lt;p&gt;&lt;strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;小结：&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;HTML5的还有很多令人心动的特性和新功能，限于篇幅无法一一举出，但我对于HTML5的前景还是非常看好的，毕竟丰富web应用的大势已经掀起，web2.0的浪潮也正在继续，让我们共同期待HTML5的降临参考：&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;center style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;&lt;img alt="" width="361" height="181" src="http://www.yixieshi.com/uploads/allimg/110714/023T33047-8.jpg" original="http://www.yixieshi.com/uploads/allimg/110714/023T33047-8.jpg" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-width: initial; border-color: initial; max-width: 650px; display: inline; " /&gt;&lt;/center&gt;&lt;/div&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-family: 'Microsoft YaHei', SimSun, Verdana, Arial, Tahoma; line-height: 28px; background-color: #ffffff; "&gt;(本文出自Tencent CDC Blog，转载时请注明出处)&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2289600.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/16/2289600.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/fly_binbin/archive/2011/12/13/2286134.html</id><title type="text">Android 为Notification加上一个进度条</title><summary type="text">package com.notification; import android.app.Activity;import android.app.Notification;import android.app.NotificationManager;import android.app.PendingIntent;import android.content.Intent;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.View...</summary><published>2011-12-13T07:06:00Z</published><updated>2011-12-13T07:06:00Z</updated><author><name>fly_binbin</name><uri>http://www.cnblogs.com/fly_binbin/</uri></author><link rel="alternate" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/13/2286134.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/fly_binbin/archive/2011/12/13/2286134.html"/><content type="html">&lt;div&gt;  &lt;div&gt;&lt;div&gt;       &lt;div&gt;package com.notification;&lt;/div&gt; &lt;div&gt;import android.app.Activity;&lt;br /&gt;import android.app.Notification;&lt;br /&gt;import android.app.NotificationManager;&lt;br /&gt;import android.app.PendingIntent;&lt;br /&gt;import android.content.Intent;&lt;br /&gt;import android.os.Bundle;&lt;br /&gt;import android.os.Handler;&lt;br /&gt;import android.os.Message;&lt;br /&gt;import android.view.View;&lt;br /&gt;import android.view.View.OnClickListener;&lt;br /&gt;import android.widget.Button;&lt;br /&gt;import android.widget.RemoteViews;&lt;br /&gt;import android.widget.Toast;&lt;/div&gt; &lt;div&gt;public class nofificationActivity extends Activity implements OnClickListener {&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static final int NOTIFICATION_ID = 0x12;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private Notification notification = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private NotificationManager manager = null;&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Handler handler;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int _progress = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private Thread thread = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private boolean isStop = false;&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 当界面处理停止的状态 时，设置让进度条取消&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void onPause() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isStop = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manager.cancel(NOTIFICATION_ID);&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super.onPause();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /** Called when the activity is first created. */&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onCreate(Bundle savedInstanceState) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super.onCreate(savedInstanceState);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setContentView(R.layout.main);&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Button btn = (Button) findViewById(R.id.Button01);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; btn.setOnClickListener(this);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification = new Notification(R.drawable.icon, "带进条的提醒", System&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .currentTimeMillis());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification.icon = R.drawable.icon;&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 通过RemoteViews 设置notification中View 的属性&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification.contentView = new RemoteViews(getApplication()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .getPackageName(), R.layout.custom_dialog);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification.contentView.setProgressBar(R.id.pb, 100, 0, false);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification.contentView.setTextViewText(R.id.tv, "进度" + _progress&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + "%");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 通过PendingIntetn&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 设置要跳往的Activity，这里也可以设置发送一个服务或者广播，&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 不过在这里的操作都必须是用户点击notification之后才触发的&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification.contentIntent = PendingIntent.getActivity(this, 0,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Intent(this, remoteView.class), 0);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 获得一个NotificationManger 对象，此对象可以对notification做统一管理，只需要知道ID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onClick(View v) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isStop = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manager.notify(NOTIFICATION_ID, notification);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thread = new Thread(new Runnable() {&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void run() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.currentThread();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (isStop) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _progress += 10;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Message msg = handler.obtainMessage();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg.arg1 = _progress;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg.sendToTarget();&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.sleep(500);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (InterruptedException e) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated catch block&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thread.start();&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handler = new Handler() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void handleMessage(Message msg) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification.contentView.setProgressBar(R.id.pb, 100, msg.arg1,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; false);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notification.contentView.setTextViewText(R.id.tv, "进度"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + msg.arg1 + "%");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manager.notify(NOTIFICATION_ID, notification);&lt;/div&gt; &lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (msg.arg1 == 100) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _progress = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manager.cancel(NOTIFICATION_ID);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isStop = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Toast.makeText(nofificationActivity.this, "下载完毕", 1000)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .show();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super.handleMessage(msg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/div&gt;     &lt;/div&gt;&lt;/div&gt; &lt;br /&gt; &lt;/div&gt;&lt;img src="http://www.cnblogs.com/fly_binbin/aggbug/2286134.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/fly_binbin/archive/2011/12/13/2286134.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry></feed>
