问题描述
以下代码用于在.aspx.cs文件中创建计时器。请尽快帮助我。它是一个在线考试申请。我需要尽快解决这个计时器问题。一个星期以来对我来说是一个很大的障碍。请帮忙。在此先感谢。
我尝试了什么:
htmlTable。追加(< script> var seconds =+ ttime +; function secondPassed(){var minutes = Math.round((seconds - 30)/ 60); var remainingSeconds = seconds%60; if(remainingSeconds< 10) ){remainingSeconds ='0'+ remainingSeconds;} document.getElementById('countdown')。innerHTML ='剩余时间: - '+分钟+':'+ remainingSeconds; if(seconds == 0){clearInterval(countdownTimer); document.getElementById('Button1')。click();} else {seconds--;}} var countdownTimer = setInterval('secondPassed()',1000);< / script>);
PlaceHolder1.Controls.Add(new Literal {Text = htmlTable.ToString()});
The below code is used to create a timer in .aspx.cs file. Please help me as soon as possible. Its an online exam application. I need to crack this timer issue soon. Its been a big hurdle for me from a week. Please help. thanks in Advance.
What I have tried:
htmlTable.Append("<script> var seconds = " + ttime + "; function secondPassed() { var minutes = Math.round((seconds - 30) / 60); var remainingSeconds = seconds % 60; if (remainingSeconds < 10) { remainingSeconds = '0' + remainingSeconds; } document.getElementById('countdown').innerHTML = 'Time Left :- ' + minutes + ':' + remainingSeconds; if (seconds == 0) { clearInterval(countdownTimer);document.getElementById('Button1').click(); } else { seconds--; } } var countdownTimer = setInterval('secondPassed()', 1000);</script>");
PlaceHolder1.Controls.Add(new Literal { Text = htmlTable.ToString() });
这篇关于在线测验:当用户点击浏览器tolbar /状态栏中的刷新按钮时,如何避免计时器刷新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!