大家好,我现在需要用ASP.NET要一个倒计时执行指定操作的方法,询问了其他专家,似乎不能用JAVASCRIPT控制时间执行操作,如果用户在浏览器上禁用JAVASCRIPT的话,这个倒计时就失效了,所以现在我打算在客户端用JAVASCRIPT做一个倒计时控件,提醒用户操作剩余时间,然后服务器上用TIMER控件进行时间控制,但是TIMER时间到缺不触发时间,不懂什么原因,请各位帮忙看看是哪里的问题?
代码如下:using System.timers;//命名空间引用Timer tm = new timer();protected void Page_Load(object sender, EventArgs e)
{
tm.Interval = TimeLimit;//TimeLimit为用户操作有效时间
tm.Elapsed += new ElapsedEventHandler(Auto_Set);
tm.Start();
tm.Enabled = true;
}
void Auto_Set(object sender, ElapsedEventArgs e)
{
//到时间执行相关操作
throw new Exception("The method or operation is not implemented.");
}
代码如下:using System.timers;//命名空间引用Timer tm = new timer();protected void Page_Load(object sender, EventArgs e)
{
tm.Interval = TimeLimit;//TimeLimit为用户操作有效时间
tm.Elapsed += new ElapsedEventHandler(Auto_Set);
tm.Start();
tm.Enabled = true;
}
void Auto_Set(object sender, ElapsedEventArgs e)
{
//到时间执行相关操作
throw new Exception("The method or operation is not implemented.");
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货