【发布时间】:2012-11-08 07:35:12
【问题描述】:
我正在使用code 在 _Layout.cshtml 页面中显示倒数计时器。
但是当我从一个页面移动到另一个页面时,计时器会在新页面加载时再次启动。
1.如何在导航到新页面时显示计时器而不重新启动。
2.如何停止用户刷新页面,使定时器不再启动。
我的布局代码:
<table width="100%">
<tr>
<td width="2%">
<img src="~/Images/philips_new.png" alt="" height="45" width="155" />
</td>
<td width="79%" align="right" class="Text_nocolor">
<span class="Text_nocolor">
@{ Html.RenderAction("GetUserName", "Login");}
</span>
</td>
<td width="4%">
<div id="counter">
</div>
</td>
<td width="4%" class="Text_nocolor" valign="middle">
<a href="@Url.Action("Index", "Login", new { controller = "Login" })">
<img src="~/Images/nome-logout.png" alt="" height="24" width="30" style="border-style: none; cursor: pointer;" /></a>
</td>
</tr>
</table>
我尝试使用 jquery 插件倒数计时器,但它显示对象不支持 IE 中的此属性错误。
任何建议都会有所帮助。
【问题讨论】:
-
停止刷新是什么意思?
-
当用户刷新页面时,计时器又从头开始计时。
-
那将会发生。您可以将值存储在 cookie 中并从 cookie 中读取。
标签: c# asp.net asp.net-mvc asp.net-mvc-3