在线考试系统的倒计时

 

  最近在做一个在线考试系统,设计到倒计时的设置,其实非常简单,只要设置一个变量,然后再Ajax的time控件的事件中递减即可。代码如下:

 //触发Timer控件的Timer1_Tick事件实现考试倒计时功能
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        this.index--;
         //考试时间到了
         if (this.index == 0)
         {
             //设置Timer控件不可见
             this.Timer1.Enabled = false;
             BindData();
             Response.Redirect("Loginout.aspx");
         }
         else
         {
             //显示考试剩余时间
             this.lbtime.Text = this.index / 60 + "分" + this.index % 60 + "秒将停止考试,请及时“提交”试卷,否则试卷作费成绩无效!";
         } 
    }
    /// <summary>
    /// 定义在线考试总时间变量index,
    /// 并设置读写属性
    /// </su
  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值